Are you familiar with using mod_rewrite in an .htaccess file in your old site's web directory?
You need to have the mod_rewrite module enabled in Apache. Once mod_rewrite is working you could redirect the old to new URLS like:
RewriteRule ^(.*)$ http://mynewdomain.com/$1 [R=301]
RewriteRule ^(.*)$ http://mynewdomain.com/404.php?url=$1 [L]
This rewriting script would need to be added to a .htaccess file located in the root directory of your old domain. If you don't know if your mod_rewrite is working then you can link to Dklynn's tutorial as there is an example there of how to test mod_rewrite.
- Line 1 enables the rewrite engine
- Line 2 maps all requests on the old site and redirects it to the new domain set with a permanent redirection flag (R=301) and the so the search engines will update the robots to go to the new domain.
- Any pages that are linked to the old site will be set in the (.*) match. The pages will then be substituted in the $1 back reference variable and so as long as the pages are named the same thing the redirection will work.
- The final rule is reached if a page is not found. The L flag tells mod_rewrite to stop processing rules. In this example the 404.php file would handle any page request that were not found. It passes a GET parameter 'url' equal to the $1 variable to your php page so the value of the not found page can be reported in the 404.php page (the php variable can be accessed via $_GET['url']).
If this doesn't work then you can do a more comprehensive rewrite map to make explicit redirects. It is more complicated to set a rewrite map up and you need to have access to your http.conf or apache.conf file as this cannot be used in an .htaccess file.
Hope this helps.