rss twitter

Redirecting non-www to www-domains

You know you can access your domain with or without a www. Besides Google Flashmovies don't like that kind of double-accessibility as security-sandbox-violations will appear. E.g. a flashmovie embedded on http://beautifycode.com cannot access http://www.beautifycode.com when not directly allowed via crossdomain-policy.

To completely prevent this (and Google will thank you, too) you can easily redirect your non-www domains to the according www-domain with a .htaccess file. Simply create a new textfile on your server, name it ".htaccess" and fill it with these lines (for sure take your domain):

CODE:
  1. RewriteEngine On
  2. RewriteBase /
  3. RewriteCond %{HTTP_HOST} !^www.beautifycode.com$ [NC]
  4. RewriteRule ^(.*)$ http://www.beautifycode.com/$1 [L,R=301]

The other way around (and the original source for that way) can be found here.

3 Responses to “Redirecting non-www to www-domains”

  1. Actually, you're doing it the wrong way. You should redirect www. to non-www! Your domain is beautifycode.com, not http://www.beautifycode.com, right? It's the protocol that say "you're using a website" (http), not the subdomain (www.). :)

  2. Marvin Blase says:

    yea, true - but ain't that a personal view? i mean i type in the www. - domain usually. or are there any known issues why you should avoid that?

  3. Check http://no-www.org/. But then again, you're right, do whatever you want.

Leave a Reply

Powered by WordPress | Free T-Mobile Phones for Sale | Thanks to Palm Pre Blog, Video Game Music and Get Six Pack Abs