Forum Moderators: phranque

Message Too Old, No Replies

301 redirect

         

JesseL

3:59 pm on Jul 15, 2005 (gmt 0)



How to set 301 redirect to do a permanent redirect to my root page at http://example.com/ (without 'www') when user visit the URL http://www.example.com?

Just like example.org, when you type www.example.org in your browser address bar, you will be automaticly brought to http://example.org/ (without www).

Thanks!

[edited by: engine at 4:22 pm (utc) on July 15, 2005]
[edit reason] examplified [/edit]

ChadSEO

6:12 pm on Jul 15, 2005 (gmt 0)

10+ Year Member



Are you running Apache? Does it have mod_rewrite? If so, then you can do the following in an .htaccess file

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

JesseL

8:53 am on Jul 16, 2005 (gmt 0)



Yes, I am running apache.
Thanks, It works.

Jesse