【发布时间】:2015-06-01 05:52:51
【问题描述】:
我的网站混合了没有变量的静态页面(例如: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
我想做的事可能吗?
【问题讨论】:
标签: php .htaccess mod-rewrite clean-urls