【发布时间】:2016-10-13 16:43:01
【问题描述】:
我在将 sto 从 apache 主机转移到 nginx 主机的两次重写时遇到问题。我已经尝试在线阅读,这是我想出的最好的,不幸的是我在 nginx 上几乎没有使用 regexp 和重写,请帮助。
apache重写
RewriteRule ^news/([^/]+)/([^/]+)/([^/]+)\.html$ news_dett.php?l=$1&par=$2&titolo=$3 [L]
结果阿帕奇
exampleSite/news/it/44/Title_Of_the_news.html
apache重写
RewriteRule ^Research-and-develop\.html$ researchdevelop?l=$1 [L]
结果阿帕奇
exampleSite/Research-and-develop.html
nginx 重写
location /news {
rewrite ^/news http://$http_host/news_dett.php?l=$1&par=$2&titolo=$3 redirect;
}
结果 nginx
点击链接exampleSite/news/it/44/Title_Of_the_news.html我们去
exampleSite/news_dett.php?l=&par=&titolo=
事实上这根本行不通
nginx 重写
location /Research {
rewrite ^/Research-and-develop\.html$ http://$http_host/researchdevelop?l=$1 redirect;
}
结果 nginx
点击链接exampleSite/Research-and-develop.html
我们去exampleSite/researchdevelop.php?l=
你能帮我为 nginx 设置正确的重写模式吗?
【问题讨论】:
标签: apache nginx url-rewriting