kieranbarnes do you know where your towel is?

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. Redirecting non-www to a www prefix
    This old chestnut again. Create or edit the .htaccess file ...
  3. [Snippet] Redirecting Non-SSL Traffic to SSL
    ...
  4. Block Countries in Apache
    Assuming you have mod_geoip installed in apache we can block certain countries in 6 lines...
  5. 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...

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.