htaccess 301 Redirect Duplicate Inner Page URL's

non-www to www

Posted on August 14, 2011 · Posted in Search Engine Optimisation · BY: Amir Farid

When it comes to optimising your website, duplicate content is always an issue but much overlooked. Many webmasters do not even realise that Google may be inadvertently looking at 2 versions of there home page. The non-www to www versions, and inadvertently be hit by the duplicate content penalty!

That’s because if you haven’t redirected your non-www to www version (or visa versa) then Google sees 2 versions of your site and slaps a duplicate content penalty on to your site.

The code below will help get rid of this. It will redirect the non-www to www version of your website via a friendly 301 redirect telling Google that the site permanently exists at the www version. Of Course this also applies for the rest of your site for which this code also helps.

Simply replace the example.com with your site reference (highlighted in green) and the save code to your .htaccess file and upload it to the root. If you don’t have a .htaccess file then simply paste the code to a text file and save it as .htaccess then upload to the root of your folder. Of course your UK Web Hosting account needs to be an based on an Apache server for this to work correctly or a server of the similar type..


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.co.uk [NC]
RewriteRule ^(.*)$ http://www.example.co.uk/$1 [L,R=301]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html
RewriteRule ^index\.html$ http://www.example.co.uk/ [R=301,L]

The last 2 lines of code above simply redirect your index file to the root and apply’s a / so that Google doesn’t cache 2 copy’s of your home page i.e. www.example.co.uk and www.example.co.uk/index.html.

You can replace the html part of the code for php or htm if that’s what your using on you site.

Amir Farid
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr

Amir Farid

Creative SEO Director at Umbrella Interactive Ltd

Amir Farid is the Creative SEO Director of Umbrella Interactive Ltd. Based in Rochdale, Greater Manchester, Umbrella Interactive provides online and digital media solutions to SME’s and start-up businesses. Umbrella Brands include Umbrella Host, SEO Umbrella and Umbrella Web Studio. You Can find him on Google+

Amir Farid
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr

@UmbrellaWebStud

We are a full service #DigitalAgency based in #Rochdale, Lancashire specialising in #WebDesign, #MagentoDevelopment, #SEO and #PPC

RT @mashable: Heroic delivery man brings pizza to ‘hangry’ stranded train passengers https://t.co/y175m7vXeE https://t.co/Sp6uaXpnpZ – 2 weeks ago
Amir Farid
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
Amir Farid
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr

Amir Farid
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr

Amir Farid
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr

Amir Farid
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr

Amir Farid
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Google+
  • Facebook
  • Pinterest
  • Twitter
  • Delicious
  • reddit
  • LinkedIn
  • StumbleUpon
  • Tumblr