Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

301 htaccess to redirect broken site links

  • 29-11-2011 06:46PM
    #1
    Registered Users, Registered Users 2 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