Hello, I am redirecting my site through a .htaccess file my site is pole2polemagazine.co.uk and I am redirecting to the .com address. But if you search google for pole2pole the .co.uk domain appears first redirecting no problem. But all of the forum posts and links to the forum give back 404 errors. The forum is no longer running as we have taken it down in a plan to launch a new one, but I'd still like its links to be directed to my .com address and not be penalized by google for having broken links. This is a copy of what my .htaccess file currently looks like: Would appreciate any help with this, Thanks.
This is what I use. This should redirect anything on the server to the home page of the .com that you would like it to go to. Keep in mind that because the rule below is a mod_rewrite (RewriteRule), nowhere else in your .htaccess should there be a mod_alias (Redirect) or you could get some unexpected results. # Catch-All Redirect # RewriteCond %{HTTP_HOST} ^(www\.)?pole2polemagazine\.co.uk [NC] RewriteRule ^(.*)$ http://www.pole2polemagazine.com/$1 [R=301,L] Code (markup): I would also recommend redirecting each individual post to the specified post on the new .com though, using rewrite rules.
Thanks for the code but it's just doing the same thing as the other code I was using. There are a lot of forum posts, what code would I use to redirect every single one of them?
That code should work. Maybe you have something else in your .htaccess that's making it act funny. If you have a ton of posts, 301 redirecting each URL would be a pain, but I think it's worth it. RewriteRule ^oldpage/(.*)$ http://new.com/newpage/$1 [R=301,L] Code (markup): If you have a list of every page in the site, you could probably use Excel to combine cells making a redirect list easier. For example in Excel, place "RewriteRule ^" in cell A, "youroldpage/" in cell B, "(.*)$ " in cell C, "http://new.com/newpage/" in cell D, and "$1 [R=301,L]" in cell E. Then in cell F, combine them all together with a formula. You can drag that formula down your entire list and then copy and paste the complete redirect list into your .htaccess.