What do you think is the best way to 301 redirect my entire domain?

If they are in separate folders, you can use the Redirect 301 / http://newdomain.com/ as well.

The only time you would not want to use Redirect 301 / http://newdomain.com/ is if your old and new files are in the same folder. As that would create an infinite loop.

Hi,The script that I earlier put, will redirect an old domain plus page name (including parameters) to the new domain. If the new site has some of the same page names then at least these pages would not loose their seo. For the others you could blanket redirect them to a sitemap in your 404:


ErrorDocument 404 /404.php
RewriteEngine on
...

That all sounds good to me. But unfortunately I dont really understand what you mean. Can you possibly rephrase that? The new domain has all of the same page names. It just has a folder in between it now where one was not there in the old domain. And the 404s? No getty?

Hi Eric,

I’ll make it clear that although I’ve been pouring many hours recently into learning mod-rewrite specifics, I am not an expert, but what I’m talking about may very well work for you.

So to be clear, the ErrorDocument 404 /404.php line is put in an .htaccess file inside the root of your new server. It goes prior to the RewriteEngine on like:


[COLOR=#ff0000]# This handler tells Apache to point any page request that come in to
# redirect a page not found (404 error) to a custom 404.php page
# It is a very good idea to put both a simple 404 message and a map of the
# New site structure so people can navigate to the main site directly.[/COLOR]

ErrorDocument 404 /404.php
RewriteEngine on

# ... more rewrite code goes here 

So to do your rewriting from your old server to the new server’s sub-directory you use a 301 - permanent redirect. Using 301s is the current recommended practise of redirecting domains. Search engine bots run through a 301 and will in time index as a permanent change. Meanwhile the SEO juice you’ve have will somewhat be retained. I mean somewhat as it seems that Google will honour most of your 301 redirects and your SERPs don’t fall. Yahoo is not quite as good and Bing may not honour them at all. However they will help moreso than doing nothing.

So on your new server in the root folder, create a .htaccess file, and put something like this:


RewriteEngine on
RewriteRule ^([a-z\\.]+)$ http://new_server.com/subfolder/$1 [R=301]

With this if you click a link in a search that has <a href=‘http://old_server.com/puddles.html’>A number of pictures of puddles</a> then the user will be redirected to [noparse]http://new_server/subfolder/puddles.html[/noparse]. As this is a generic match [noparse]http://old_server.com/puddles.php or http://old_server.com/puddles.aspx will be redirected to http://new_server.com/subfolder/puddles.php and http://new_server.com/subfolder/puddles.aspx. [/noparse]

With this all your web files will redirect to the new server and they will look for the same file names and extensions as on the old server.

DK may be able to chime in here and give you a far superior way. I do know that the approach I recommend is not greedy or taxing on your old server.

Regards,
Steve

It’s really nice topic of 301 redirection. It is a really awesome information about 301 Redirection and thanks to all about this discussion.

Thank you. But if I have 17 different subfolders that would not work right?

Yes you’re correct. You may either look at reorganizing your file structure, if this is too enormous of an undertaking then you may have to not use a generic .htaccess and use a rewrite map. But with lots of links this could be a lot of work for you and for your web-server. It really depends on if you want to retain the SERPs as they take time to build-up.

Another question about RewriteMap. Please view the other current thread about 1000+ redirections for a discussion of your options.

Regards,

DK