kieranbarnes these are the things i learnt today

Redirect a www prefixed site to a non-www prefix

Posted on July 10, 2007

I like clean URLs.

Add this to your .htaccess in the site root

RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^DOMAIN\.com
RewriteRule (.*) http://DOMAIN.com/$1 [R=301,L]

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Related posts:

  1. .htaccess redirect based on requested domain
    Imagine you have a selection of domain names that point to the same site, are...
  2. Block Countries in Apache
    Assuming you have mod_geoip installed in apache we can block certain countries in 6 lines...
  3. Redirecting WordPress index.php to root
    If you check the Page Rank of http://bloke.org against http://bloke.org/index.php, which are both, to a...
  4. mod_geoip Revisted including stopping spam in phpBB 2
    I've recently moved a client's forum onto a new cPanel server, previously it was on...
  5. Site Performance Quick Fixes
    I've been playing around with YSlow for a while now, now I decided to a...

What this article useful to you?



Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the Geeky category.

Filed under: Geeky Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.