Can anyone help with my .htaccess file...

Discussion in 'Site & Server Administration' started by theplastickid, Oct 16, 2009.

  1. #1
    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.
     
    theplastickid, Oct 16, 2009 IP
  2. SEOHolicc

    SEOHolicc Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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.
     
    SEOHolicc, Oct 16, 2009 IP
  3. theplastickid

    theplastickid Well-Known Member

    Messages:
    261
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    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?
     
    theplastickid, Oct 16, 2009 IP
  4. SEOHolicc

    SEOHolicc Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    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.
     
    SEOHolicc, Oct 19, 2009 IP