当前是:
http://www.vitalimaging.com/about.php?page=overview_vision
想清理网址,这是我的代码:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^about/([A-Za-z0-9-]+)/?$ about.php?page=$1 [L]
为什么它不工作?
当前是:
http://www.vitalimaging.com/about.php?page=overview_vision
想清理网址,这是我的代码:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^about/([A-Za-z0-9-]+)/?$ about.php?page=$1 [L]
为什么它不工作?
您的示例在查询字符串中也有下划线,但您的正则表达式RewriteRule
不包括_
. 像这样简化你的正则表达式:
通过启用 mod_rewrite 和 .htaccess httpd.conf
,然后将此代码放在您.htaccess
的DOCUMENT_ROOT
目录下:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(about)\.php\?page=([^&\s]+) [NC]
RewriteRule ^ /%1/%2? [R=302,L]
RewriteRule ^about/([^/]+)/?$ /about.php?page=$1 [L,QSA,NC]