Somehow, as simple as it is, I always manage to screw up 301 redirects beyond the simplest of things. I've been studying up a bit more on mod rewrite lately, and just moved over a new site. Can anyone verify that I've done this correctly?
The goals:
The code..
.htaccess file on old site:
.htaccess file on new site (root directory):
It seems simple enough, but I really can't afford to have this thing get creamed in google because I fucked it up and left something wrong sitting there for 2 weeks.
The goals:
- move olddomain.com to newdomain.com/subdirectory
- redirect newdomain.com homepage to newdomain.com/subdirectory
- redirect non-www to www
The code..
.htaccess file on old site:
Code:
RewriteEngine On
RewriteRule ^(.*)$ http://www.newdomain.com/subdirectory/$1 [R=301,L]
.htaccess file on new site (root directory):
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.newdomain\.com$
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
RewriteRule ^(/)?$ forum [L]
It seems simple enough, but I really can't afford to have this thing get creamed in google because I fucked it up and left something wrong sitting there for 2 weeks.