如何允许用户导航到这个url example.com/aaron about,并在幕后将其更改为example.com/about?id=52,但仍然在浏览器example.com/aaron about上显示这个url。
在我的.htaccess文件中尝试了这种方法,但我似乎没有工作:
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !\.php$
RewriteRule ^(.*)$ $1.php [L,QSA]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^/aaron-cole-about$ /about?id=52 [L]修正了现在
发布于 2013-08-09 03:27:36
你只需要重新整理你的规则。
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^/aaron-cole-about$ /about?id=52 [L]
RewriteRule ^(.*)$ $1.php [L,QSA]发生了什么,它是匹配的(.*) - a.k.a。匹配任何-规则,这使您更具体的规则不可达。
https://stackoverflow.com/questions/18139578
复制相似问题