1

尝试我的 .htaccess 页面重写此 url

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
4

1 回答 1

2

通过启用 mod_rewrite 和 .htaccess httpd.conf,然后将此代码放在您.htaccessDOCUMENT_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]
于 2012-04-26T17:51:33.780 回答