A large part of our identity here at Coffeeblack is that of a web-design company, however no two websites are the same, consequently we are always running into new problems. Many of our clients are at a basic or intermediate level when it comes to understanding how the internet works, as a reuslt we’re going to start covering some of the more common problems people face when learning from the gorund up. 

Let’s Start Simple:

A good amount of people think that your browser automatically redirects http://yourdomain.com to http://www.yourdomain.com; this isn’t the case. There a whole host of reasons that you don’t want people going to two different URL’s:

  • Aviods any duplicate content in the SERPs
  • Aviods any possiblity of split page rank/split link popularity
  • It’s far more consistent
  • Better user experience
  • Follows Googles guidlines

I’m going to do a short, simple tutorial on how you too can impliment this redirect, for the purposes of the tutorial I’m assuming you’re using an Apache web server.

1. Download Filezilla

Filezilla is the most well known FTP application currently availible, it will do everything you need for this tutorial

2. Install Filezilla

Simple double click the file that you downloaded and follow the instructions

3. Find Your Login Details

If you don’t already have these details this is going to be different for a lot of people due to server configurations the best thing you can do is contact your hosting for information.

4. Login

Once you’re successfully connected you should see Filezilla has populated a list of folders that you can access

5. Navigate to Public_html

Public_html is what is considered to be the root folder, it may be that you are already inside the root folder, the best way to find where you are is to keep clicking the ‘‘ that should be at the top of the folders until you either can’t continue or until you can see Public_html 

6. Find .htaccess

Inside the root folder you should see a small file called .htaccess if you can’t find it then feel free to create a new file, make sure it’s called .htaccess and not .htaccess.txt. or any other file extension.

7. Backup .htaccess

Simple copy the file somewhere safe just incase something goes wrong as you need to rollback to a previous version

8. Edit .htaccess

Once you have found the file right-click and select edit. It should open up Notepad.exe, the file may be empty (it will be if you just created it) this is fine, or it may already have some text inside, be careful not to delete any of the text just in case it’s needed.

Somewhere in the document copy the following text:  

##Custom Edits:
#Non-www To www Re-Write

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]

Don’t forget to replace yourdomain.com with your actual domain else it’s not going to work!

The easiest place to put this is right at the top of the document that way you can be sure that it’s not interupting any other scripts. At this point you need to save the file (Control Key + S) and then close the file, looking back at Filezilla it should ask if you want to upload the edited file, hit yes. .htaccess should only take a couple of seconds to upload, now all that’s left is to test that it works.

Test it!

Simply navigate to http://yourdomain.com if it redirects you to http://www.yourdomain.com then everything is in working order, if not double check what you did!If you’re sitll having problems please drop me a message andI’ll see what I can do!

Leave a Reply