很久以前我更换过wordpress伪静态结构,并且用.htaccess文件做了301 重定向,如今Google早就把我的链接更换过来了,就只有baidu还有少量页面还是以前的结构,因此如今换了空间还是得要保留原来的.htaccess。
以前的.htaccess
Redirect permanent /author /archives/author Redirect permanent /date /archives/date Redirect permanent /category /archives/category Redirect permanent /tag /archives/tag RedirectMatch 301 ^/(.+)-(\d+)\.html$ /archives/$2 RedirectMatch 301 ^/(.+)-(\d+)\.html/comment-page-(\d+)$ /archives/$2/comment-page-$3
服务器直接 就 500 了! 我真郁闷,还用404.php 实现了301重定向。但现在我找到原因了,原来这个主机用了Redirect 就会 htttp 500 ,而RedirectMatch没事,我索性全部都换成RedirectMatch
RedirectMatch 301 ^/author(.*)$ /archives/author$1 RedirectMatch 301 ^/date(.*)$ /archives/date$1 RedirectMatch 301 ^/category(.*)$ /archives/category$1 RedirectMatch 301 ^/tag(.*)$ /archives/tag$1 RedirectMatch 301 ^/(.+)-(\d+)\.html$ /archives/$2 RedirectMatch 301 ^/(.+)-(\d+)\.html/comment-page-(\d+)$ /archives/$2/comment-page-$3
呵呵,搞定!
Tags: 标签:301重定向, wordoress, 伪静态
本博客所有文章如果没加特殊说明均为原创,如需转载引用请注明出处
[重阳博客:http://www.99xunle.com/archives/802]
[重阳博客:http://www.99xunle.com/archives/802]
| 随机文章 | 相关文章 |
|---|---|

Redirect 和RedirectMatch哪不一样啊
Reply
学习了,RedirectMatch。
一直在用 Redirect 但是没有加 permanent。
.htaccess有很多可研究的地方,到现在还没研究明白。
Reply