比较规范的Joomla 301重定向规则

Moderator: eyesofkids

Locked
haiwasnm
Joomla! Apprentice
Joomla! Apprentice
Posts: 48
Joined: Thu Apr 05, 2007 1:32 pm
Contact:

比较规范的Joomla 301重定向规则

Post by haiwasnm » Tue Dec 20, 2011 1:43 am

分享一下这个规则,也许用的人不多,有待讨论

Code: Select all

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]
#
RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteCond %{SERVER_PORT}>s ^(443>(s)|[0-9]+>s)$
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]
#
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]


RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

这是旧域名转新域名时所用,如果仅仅是网址规范化,这行可以去掉

 
 
Locked

Return to “Chinese Forum”