Simple .htaccess Hack for Drupal SEO


By Colin - Posted on 16 April 2009

Follow Me On Twitter

On a fresh install of Drupal, you'll encounter issues with how your website's domain can be accessed. Out of the box, you'll be able to access your site both with and without the "www" prefix. This can be a problem for SEO, as the potential exists for search engines to think your website contains duplicate content, even when it doesn't. This isn't a fix that will lead to dramatic improvements, but it's a good SEO best practice for Drupal sites.

Step 1: Find Your .htaccess File

This file will be located in the directory where you installed Drupal.

wheresthehtaccess.jpg

Step 2: Download to Your Desktop and Edit

Use your favorite HTML editor.

Step 3: Find the Code

Should be around line 80.

heresthecode.jpg

Step 4: Edit the Code

Uncomment (delete the # from lines 87 & 88) and adapt (change "example.com" to your domain, be sure to leave any other characters such as the "^" or "\")

thisiswhatyouchange.jpg

Step 5: Upload and Replace

And you're done! No matter how you type in your domain, it should all redirect to the "www" version.

Your rating: None Average: 5.2 (5 votes)
Login or register to tag items
2.03

From my understanding duplicate with and without www isn't that much of a problem any more, right or wrong?

Car Insurance quotes
Shop and compare for insurance including car insurance, whole life insurance and term life insurance.
cheap car insurance
whole life insurance
Free insurance quotes offering best auto insurance, whole life insurance, term life insurance, cheap car insurance.
Offers coverage for auto, whole life insurance, and more. Get insurance rate comparisons.

Thanks for this amazing article. You have shared good insights and experience. It’s an interesting article to read.
Custom Term Paper

Nice post! You have worked hard on jotting down the essential information. Keep sharing the good work in future too.

Coursework

It was a very nice article! Just want to say thank you for the information you have shared. Just continue writing this kind of post. Thanks.

Assignment Writing

Hi,
I am really thankful you have shared useful information. I am very happy to read this article, thanks for giving us nice info. I really appreciate this post.

UK Dissertation

With your help only people know something just about custom dissertation! Therefore they buy the nice dissertation subject connecting with this post in the thesis writing service.

the information u have given its so much useful

Research papers

4.2

From my understanding duplicate with and without www isn't that much of a problem any more, right or wrong?

auto insurance quotes

5.6

From my understanding duplicate with and without www isn't that much of a problem any more, right or wrong?

Mia
Me

i learned from this trick alot that was very nice of you thanks again for htaccess secret Term Paper Help | Thesis Help

cPanel you need to make sure you have marked the option to show dot-files such as .htaccess.
Dissertation Help | Essay Help | Research Paper Help

most people do not know how to properly set up their ht access file and make the same mistakes.. be careful. oh and great post!

Thanks for the post, i learned from this trick alot that was very nice of you thanks again for htaccess secret

Thanks, this is simple to do but brilliant.
When you access the File Manager i cPanel you need to make sure you have marked the option to show dot-files such as .htaccess.

Ofentimes, simplicity = brilliance...

Request a Quote

Contact Us Tel: 866.277.9958
4228 N. Central Expressway
Suite 210
Dallas, TX 75206
Get your free quote!

NEWSLETTER SIGN UP

Upcoming Events

03/12/2010 - 12:00am - 03/16/2010 - 12:00pm
04/13/2010 - 12:00am - 04/15/2010 - 12:00pm
04/19/2010 - 12:00am - 04/21/2010 - 12:00pm