Advertise
Drop Me an Entrecard
Top Entrecard Droppers
Categories / Archives
Top Level Web Directory Categories
Subscribe
Add to Google Reader or Homepage Subscribe in NewsGator Online
Add to My AOL Add to netvibes Subscribe in Bloglines

  • Posted the Entrecards, The Dropper How To (http://tinyurl.com/6hmg5o) another great How To from Lobo Links
  • Congrats to Entrecard for their latest creation Entrebar http://tinyurl.com/5pygbw. Now if they could only cure that bounce rate problem.
  • Auto Industry reports truck and suv sales decline according to the WSJ. Gas in MS is 3.45'ish a gallon. http://tinyurl.com/5np6gf
  • Published a new post: Bounce Rate, Part of the Google Quality Metric? ( http://tinyurl.com/6napz8 )
  • Published a new post: Top Entrecard Droppers for July 2008 ( http://tinyurl.com/54pzw6 )

301 redirects for Directory Owners

October 5th, 2007 by Mack

Earlier today I was checking on some new links for the directory and some old ones. I ran across a blog post from Links Juice Blog by eazenet. Eaze was discussing Ten Tips for startup directories. One of the first tips was in regards to using 301s to eliminate duplicate content via the .htaccess file.

I am taking a wild guess and saying that almost all reading will have heard of this. Many things are possible with this smart solution. But one thing many website owners and definately directory owners forget to do is select ONE option for URL rewriting. E.g. Your website is accessible via both http://domain.com and http://www.domain.com.

Now why is this important? Having both URLs working without a rewrite can cause confusion, and often lower your chances of getting higher in SERPs as Search Engines will see two different versions of your site, and eventually you’ll have duplicate content issues..


I thought I might could provide some insight on how to get this done.

Forcing the www

Open your .htaccess in your root directory and find

HTML:
  1. RewriteEngine On

On a new line below add

HTML:
  1. RewriteBase /
  2. RewriteCond %{HTTP_HOST} ^lobolinks.com$
  3. RewriteRule ^(.*)$ http://www.lobolinks.com/$1 [R=301,L]

If your url is non-www based say (http://lobolinks.com). You can use the same code just modify it a bit.

HTML:
  1. RewriteBase /
  2. RewriteCond %{HTTP_HOST} ^lobolinks.com$
  3. RewriteRule ^(.*)$ http://lobolinks.com/$1 [R=301,L]

Redirecting the Index.php

A common problem I see with some directories is when you click the logo or the home button it takes you to http://www.yoursite.com/index.php. You can also correct this with the .htaccess.

Use the following snipplet, below Rewrite engine on

HTML:
  1. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
  2. RewriteRule ^index\.php$ http://www.lobolinks.com/ [R=301,L]

So your final .httacess with both mods applied might look something like this

HTML:
  1. RewriteEngine On
  2.    #----Redirect index.php---------------------
  3. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
  4. RewriteRule ^index\.php$ http://www.lobolinks.com/ [R=301,L]
  5.      #----Forcing the www------------------------
  6. RewriteBase /
  7. RewriteCond %{HTTP_HOST} ^lobolinks.com$
  8. RewriteRule ^(.*)$ http://www.lobolinks.com/$1 [R=301,L]

With a little modification these mods could be applied to any site. I use it on all of mine.

Edit: I applied it to my blog. This will give a good idea how to use it on wordpress and in sub-directories. It took some adapting and working out, but I finally got it to play.

HTML:
  1. # BEGIN WordPress
  2. <IfModule mod_rewrite.c>
  3. RewriteEngine On
  4.    #----Redirect index.php---------------------
  5. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /blog/index\.php\ HTTP/
  6. RewriteRule ^index\.php$ http://www.lobolinks.com/blog/ [R=301,L]
  7.      #----Forcing the www------------------------
  8. RewriteBase /blog/
  9. RewriteCond %{HTTP_HOST} ^lobolinks.com$
  10. RewriteRule ^(.*)$ http://www.lobolinks.com/blog/$1 [R=301,L]
  11. RewriteCond %{REQUEST_FILENAME} !-f
  12. RewriteCond %{REQUEST_FILENAME} !-d
  13. RewriteRule . /blog/index.php [L]
  14. </IfModule>
  15.  
  16. # END WordPress

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • del.icio.us
  • StumbleUpon
  • Sphinn
  • Mixx
  • Reddit
  • Technorati

Related Post

5 Responses

  1. By Coolseller on Oct 8, 2007 | Reply

    Lobo,

    that's really great and Handy MOD.
    Surely it help to increase directory quality.

    that's best of your's.

    cheers...

  2. By Imran on Oct 10, 2007 | Reply

    Thanks, I knew the other one, but never realised the index.php issue.
    Thanks.

  3. By Mack on Oct 10, 2007 | Reply

    I went back and added an example with the use of a sub-directory like /blog/.

    Hope it is helpful.

  4. By web on Jan 4, 2008 | Reply

    good tips.

    Thanks !

1 Trackback(s)

  1. Oct 16, 2007: Grow A Blog » floppy: Needlessly 301 Redirecting To /index.htm (Search Engine Optimization (SEO))

Leave a Reply