.

My Redirects to WWW Work!

by Adam Pieniazek on April 8, 2008

in Blog, Personal Achievements, Technology

Yes!

A long time ago (in this galaxy, not one far away), after reading Daniel’s WWW or no-WWW? post I implemented an Apache redirect in my .htaccess file to redirect my non-www address to www.adampieniazek.com/. It worked, but all non-www addresses would redirect to my homepage instead of to each individual page (for instance, adampieniazek.com/about/ would go to www.adampieniazek.com instead of to www.adampieniazek.com/about/). Well, it kept bugging me and bugging me and I kept trying alternate ways to get this to work properly and today it finally works right!

Here’s the piece of code that finally sorted out the kinks:

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

Credit goes to the good people at no-www for putting the code in their FAQ (though switched to redirect the www address to the non-www address).

If anyone experiences any issues, please drop me a quick line.

Enjoyed this post? Share it!
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • LinkedIn
  • Reddit
  • StumbleUpon
  • TwitThis

Leave a Comment

Additional comments powered by BackType

Previous post: The Final Two: An Update to My Final Four Picks

Next post: Quick Note to My Feed Readers