【发布时间】:2015-11-11 23:11:05
【问题描述】:
我目前在Apache 中使用此htaccess 代码将地址栏中的URL 从http://www.domain.com/list?m=100 更改为http://www.domain.com/list/100
RewriteEngine On
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]*)$ index.php?m=$1 [QSA,L]
</IfModule>
上面的htaccess在/list目录下。
我尝试将其转换为nginx(使用http://winginx.com/en/htaccess),但无法正常工作。这是我尝试过的
location /list/ {
if (!-e $request_filename){
rewrite ^/([^.]*)$ /index.php?m=$1 break;
}
}
上面只是下载PHP代码。我也尝试将break改为last,但它只是打开主页(地址栏中的url更改为http://www.domain.com/list/100)。有什么建议可以让它发挥作用吗?
【问题讨论】:
标签: php apache .htaccess mod-rewrite nginx