Simple .htaccess Hack for Drupal SEO

Simple .htaccess Hack for Drupal SEO

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 Drupal 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

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.

Related Posts

Hack to Move Entities Without a Machine Name Through a Development Workflow

Dustin Currie
Read more

Quick Enhancements to Make Drupal Content Admin Dirt Simple

Tom McCracken
Read more

Drupal Mega Menus Made Simple

Mark Carver
Read more

Yet another simple Amazon S3 backup script for Drupal

Randall Knutson
Read more

A simple bash script to back up your Drupal sites

davidmcgarry
Read more

A Simple Entity Data API for Module Builders

Tom McCracken
Read more