尝试我的.htaccess页面重写此网址
www.mywebsite.com/view.php?2012/this-is-page.html
到
www.mywebsite.com/view.php/2012/this-is-page.html
“view.php”是模板......我只是不喜欢“view.php?”
最后让这个CMS使用“?”工作在“view.php”而不是“/”之后 - 现在,如何在浏览器URL窗口中重写它?
到目前为止,我有:
#Fix Rewrite
Options -Multiviews
RewriteEngine on
答案 0 :(得分:2)
通过httpd.conf
启用mod_rewrite和.htaccess,然后将此代码放在.htaccess
目录下的DOCUMENT_ROOT
中:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
# external redirect from view.php?2012/this-is-page.html to view/2012/this-is-page.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+view\.php\?([^\s]+) [NC]
RewriteCond ^ view/%1? [L,R]
# internal forward from view/2012/this-is-page.html to view.php?2012/this-is-page.html
RewriteCond ^view/(.+)$ view.php?$1 [L,NC,QSA]