House of Xrvel

Just another WordPress weblog

With or Without WWW

with 2 comments

Folks, some of you have might have a website. For example you develop http://www.google.com (OF COURSE this is just an example :) ). You might have a question, whether use http://google.com (w/o “www”), or http://www.google.com (w/ “www”). I don’t suggest that “www” is better, vice versa. But i’ll tell it about how to use with only, or without only.

The key is, you must create a .htaccess file in your root directory (or modify the old one if you’ve had it)

If you choose with www, use it in your .htaccess file

<IfModule mod_rewrite.c>
  RewriteEngine on

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

</IfModule>

If you choose without www, use it in your .htaccess file

<IfModule mod_rewrite.c>
  RewriteEngine on

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

</IfModule>

Note : Your server must support rewrite module.

Written by Xrvel

May 15th, 2008 at 1:48 pm

Posted in Website

Tagged with

2 Responses to 'With or Without WWW'

Subscribe to comments with RSS or TrackBack to 'With or Without WWW'.

  1. ternyata buanyak bgt yg harus dpelajari yaks ?

    wish me luck bro :)

    ghprod

    31 Jul 08 at 2:38 am

  2. Hehe sip bro :D

    admin

    31 Jul 08 at 7:26 pm

Leave a Reply