« | »

301 Redirect and Dreamhost

By Studge | March 24, 2007

I recently needed to redirect a domain name to another domain name. This was due to having both the .com and the .net extension. I wanted to forward the .net domain to the .com domain. Dreamhost provides a redirect option in their control panel. I implemented this feature and then started testing it a bit – what I came to find out was not very encouraging. If I typed in http://example.net/ in my browser, then I was flawlessly redirected to http://example.com/. Great – that is naturally what I expected. However, a problem arose when I went to specific locations of the .net domain.

The domain had already been submitted to the search engines and, as such, had already been indexed. This meant that there were locations that may be checked. While using Dreamhost's redirect option, users trying to go to http://example.net/contact/ would be redirected to http://example.comcontact/. This is, of course, a completely bogus URL and would return a page error. Having a request redirected to a location like this would lower your sites standing in the search engines' indexes. The solution came by implementing my own 301 Redirect in the domain's .htacess file. I wiped out the existing .htaccess file from that domain (it was leftover from the previously installed CMS). I then created a new one in its place that only consisted of the following one line:

Redirect 301 / http://example.com/</pre>

That was it. After that, any specific requests sent to the .net domain were translated over to the .com URL and redirected accordingly.

Topics: SEO, Web Development

Share: del.icio.us | digg | reddit

RSS feed | Trackback URI

Comments »

No comments yet.

Name (required)
E-mail (required - never shown publicly)
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.