The Blog Studio

We are internet culture creators with a focus on
DESIGN, DEVELOPMENT & SOCIAL MEDIA.

Blog > How-to's > How to set up a 301 redirect using htaccess

How to set up a 301 redirect using htaccess

Peter F, 31 January, 2007 0 Comments


How to set up a 301 redirect using htaccess you ask? Better yet, why would one do such a thing?

Both are questions I was asking myself late last week. A friend had mentioned that there were SEO implications to having both theblogstudio.com and http://www.theblogstudio.com floating on the net.

See, Google et al treat theblogstudio.com and www.theblogstudio.com as separate sites. Technically, www is a subdomain, similar to this.that.com, where that.com is the domain, and this is the subdomain.

In other words, www.theblogstudio.com and theblogstudio.com might be stealing page rank and search juice from each other. This will not do!

This is where the 301 redirect comes in. A redirect simply tells any
browser that’s looking for theblogstudio.com to automatically go to www.theblogstudio.com. Setting up is pretty simple, if you’re comfortable editing files on a server.

Assuming you know your way around an ftp program (I use Transmit,
for the mac), point your self at your hosting account. Look in the root
or public_html folders (setup may be different, according to your host)
and try to find a file called .htaccess Note the . before the name. This
means that it’s a hidden file. You may have to look for “Show Hidden
Files” in your ftp program. Try looking in Preferences or under the View
menu.

Not all blog programs require .htaccess, and not all hosting plans
allow it’s use. So you may be out of luck using this technique. Not to
fear though! Webconfs.com lists 7 different ways to create a 301 redirect.

Assuming you’ve found the .htaccess file, make a copy of it somewhere
for backup. Next, open the file in a text editor. The following is from
webconfs.com/how-to-redirect-a-webpage.php (reposted here with permission).

Redirect to www (htaccess redirect)

Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to http://www.domain.com

The .htaccess file needs to be placed in the root directory of your old
website (i.e the same directory where your index file is placed)

Options +FollowSymlinks

RewriteEngine on

rewritecond %{http_host} ^domain.com [nc]

rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

Please REPLACE domain.com and http://www.newdomain.com with your actual domain name.

Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

You can stick this at the end of your existing .htaccess file. Now
replace the version on the server with your modified file (you did make a
backup of the original file, right?). Test it out.

You can use a 301 redirect for a variety of things, including moving
domains (just point your old URL to the new site), directing search
engines when you move a file, and more. Creating a 301 redirect is a
gentle way to enter the dark world of .htaccess. With a little
knowledge, and a good command of copy and paste, you can customize your
.htaccess file to do some very useful things. For a great list of stupid
htaccess tricks, check out Perishable Press

Comments are closed.

Feature

We are looking forward to the holidays. We'll all be at #hohoto supporting an amazing cause & dancing our butts off. Come dance with us.

RFP

Excited? So are we! Fill out our RFP and start from there!

Request For Proposal

Facebook

Flickr

Newsletter

Subscribe to our newsletter!

Subscribe to our mailing list

* indicates required
×