Thank you. But if I have 17 different subfolders that would not work right?Quote:
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:
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.Code:
# 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.
ErrorDocument 404 /404.php
# ... more rewrite code goes here
So on your new server in the root folder, create a .htaccess file, and put something like this:
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 http://new_server/subfolder/puddles.html. As this is a generic match 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.Code:
RewriteRule ^([a-z\.]+)$ http://new_server.com/subfolder/$1 [R=301]
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.