Merging two 301 redirects into one in .htaccess
I want to redirect www.mysite.com/* to mysite.com/* and /forum/* to /*
The lines I managed on .htaccess are:
RewriteEngine on #www.mysite.com -> mysite.com RewriteCond %{HTTP_HOST} ^www.mysite.com$ [NC] RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,C] #/forum/ to / RedirectMatch 301 ^/forum/(.*)$ http://mysite.com/$1
These instructions create two 301 redirections for URLS like http://www.mysite.com/forum/
Does it hurt SEO? In what extent?
How can I merge those two instructions and create one single instruction (maybe with complex RegExps) that does it with a single 301 redirection?
Thanks in advance!开发者_如何学运维
301 has slight effect on external links to your old URLs. But nothing significant. As apparently google shaves little PR juice because of redirect.
Your all internal links need to be changed to your new format. So that all the internal links juice is transfered as it is.
Regarding part 2, better keep them two separate rewrites, as both looks different functionality. (They wont hurt much).
精彩评论