开发者

mod_rewrite: rewrite rule or redirect?

If I use an internal rewrite rule to change my web page names instead of a redirect,it appears that I will have a duplication of content? For example, if I rewrite /oldpage.html to /working-person.html, it gets an internal redirect to working-person.html. This act开发者_如何学Pythonually works. But oldpage.html is still a "direct" link, and does not show a 301.

The server throws a 500 error if I add [R] or [R=301] at the end: RewriteRule ^oldpage.html$ working-person.html [R=301].

On the other hand, Redirect 301 /oldpage.html hXXp://www.example.com/working-person.html works. Should I just use a redirect?

I thought I read somewhere to use rewriterule instead of redirect when using other directives. Why use an internal rewrite if you get duplicate content?

Thanks for any ideas/opinions.


That is case to case basis. On your case you should use HTTP 301 permanent redirect in order to avoid content duplication. I personally use rewrites only to make links user and SEO friendly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜