【发布时间】:2015-10-18 09:46:44
【问题描述】:
在我的网站中,两个重写规则相互冲突 我有我的用户的网址,例如= http://twekr.com/sam 我所有的网站页面都像http://twekr.com/login一样打开
现在这里是 htaccess 文件规则
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?user=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ profile.php?user=$1
现在只有这条规则有效,因为它首先加载 =
RewriteCond %{REQUEST_FILENAME} !-d
如果我把配置文件重写规则放在上面
RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?user=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ profile.php?user=$1 (then this works)
这不是
RewriteCond %{REQUEST_FILENAME} !-d (does not work)
htaccess 规则有什么问题?
【问题讨论】:
标签: php apache .htaccess mod-rewrite url-rewriting