我有一个网站,它包含没有变量的静态页面(例如: about.php)和一些动态页面(例如: searchresults.php?a=1&b=2)。
现在,我的.htaccess允许静态页面显示,而不是动态页面。然而,为了使动态页面正常工作,我所做的一切都破坏了静态页面的干净URL。
RewriteEngine On
DirectoryIndex index.php index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]我希望最终结果如下:
http://example.com/about.php -> http://example.com/about和
http://example.com/searchresults.php?a=1&b=2 -> http://example.com/searchresults/1/2我想要做的事有可能吗?
发布于 2015-06-01 06:08:32
为您的htaccess文件尝试下面的代码行。
RewriteEngine on
RewriteRule aboutus/$ about.php [NC,L,QSA]
RewriteRule searchresults/(.*)/(.*)/$ searchresults.php?a=$1 & b=$2 [NC,L,QSA]https://stackoverflow.com/questions/30566451
复制相似问题