WordPress独立IP虚拟主机修改.htaccess文件URL301重定向成功!
今天终于把自己博客的URL 301重定向做好了。真是费尽波折啊。
本人博客为http://www.isyeo.com/
原本URL格式为 http://www.isyeo.com/a/b/
先301到 http://www.isyeo.com/a/b.html
最后经过配置 .htaccess 文件成功重定向,格式如下:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^(.*)/(.*)/$ $1/$2.html [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^(.*)/(.*)/$ $1/$2.html [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
本文转自黄聪博客园博客,原文链接:http://www.cnblogs.com/huangcong/archive/2011/04/14/2015812.html,如需转载请自行联系原作者