Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

301 htaccess to redirect broken site links

Options
  • 29-11-2011 6:46pm
    #1
    Registered Users Posts: 90 ✭✭


    Hi there,
    I'm just looking for the correct way to do a 301 redirect through htaccess.

    my scenario:

    I had a old site, let's call it mydomain.com. And we created a new shop. The new shop can be found at mydomain.com, but we want to direct people to mydomain.ie as default.

    There are several pages listed on Google for the old site that are now obsolete. I want to tell Google that these pages are gone and use a 301 to permanently redirect people that try to access these pages to mydomain.ie

    The code I've inserted in my htaccess file is:

    RewriteCond %{HTTP_HOST} ^mydomain.com$ [nc]
    RewriteRule ^(.*) http://www.mydomain.ie%{REQUEST_URI} [r=301,nc,l]


    This doesn't seem to work, for example, if I go to mydomain.com/old_file.html, I want this to redirect to mydomain.com, instead it gives me a 404 error as the file doesn't exist anymore.
    I've also generated and submitted a new sitemap through google webmaster tools.


    thanks


Comments

Advertisement