【发布时间】:2016-12-21 16:18:38
【问题描述】:
我正在尝试配置 Nginx,以便将所有对 http://domain.com/path 的请求都重写为 http://domain.com/。
我不想要重定向,因为我希望 URL 仍然显示原始路径。
示例重写:
http://domain.com/path/index.php -> http://domain.com/index.php
http://domain.com/path/category/books -> http://domain.com/category/books
http://domain.com/path/books.php?q=harry -> http://domain.com/books.php?q=harry
location /path
{
root /var/www/html/;
}
location /path
{
alias /var/www/html/;
}
【问题讨论】: