.htaccess - 301 redirection - front page to subdirectory -
i needed redirect od domain new one. paths same on both domains except front page, needed redirected www.mydomain.com www.mydomain2.com/newpath. googled , came code works. question if valid , if pageranks transfered without problems. thank you
rewriteengine on rewritecond %{http_host} domain\.com [nc] rewritecond %{request_uri} ^/$ rewriterule ^(.*)$ http://www.domain1.com/folder/ [l,r=301] rewriterule ^(.*)$ http://www.domain1.com/$1 [l,r=301]
your code should work can fine tuned bit. please consider refactored code:
options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / rewritecond %{http_host} ^(www\.)?domain\.com$ [nc] rewriterule ^$ http://www.domain1.com/folder/ [l,r=301] rewritecond %{http_host} ^(www\.)?domain\.com$ [nc] rewriterule ^ http://www.domain1.com%{request_uri} [l,r=301]
Comments
Post a Comment