treehouse : what would you like to learn today?
Web Design Web Development iOS Development

.htaccess 301 redirect vs rewriteRule?

  • Hello. I've changed domains and have almost finished moving it all. 800+ pages. Took me awhile. The folder structure has changed in the new domain. So it will make this easy. I simply want to take all traffic from the old domain and redirect it to the root of the new domain. Now my only question that remains is which way is better?

    Redirect...

    Redirect 301 / http://www.example.com/

    Or rewriteRule...

    Options +FollowSymLinks RewriteEngine on # RewriteCond %{HTTP_HOST} !^www.newdomain.com RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

    Anyone have any knowledge about this? Only forums I know that do don't like answering these redirect questions as they have seen them a lot.

    Thanks!

    Eric, W

  • 301 is basically for users who do not have mod_rewrite. Either way is fine.