leungeric.com

Digg del.icio.us Technorati StumbleUpon Twitter

Force www. in your URL using .htaccess

.htaccess | Tutorials & Resources

1 Star2 Stars3 Stars4 Stars5 Stars (1 out of 5)
Loading ... Loading ...

Just add the following code to your .htaccess file in the highest folder of your web directory and yor visitors will be forced to use the www version.

RewriteEngine on

RewriteCond %{HTTP_HOST} !^www.your_domain.com$

RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301]

  • Digg
  • del.icio.us
  • Technorati
  • StumbleUpon
  • Reddit
  • TwitThis
  • Sphinn
  • BlinkList
  • Furl
  • Mixx
  • NewsVine
  • Slashdot
  • Ma.gnolia
  • Facebook
  • Google
  • E-mail this story to a friend!

No Comments, Comment or Ping

Reply to “Force www. in your URL using .htaccess”

Sponsors