The MU forums have moved to WordPress.org

domain with www AND no-www (2 posts)

  1. shobo
    Member
    Posted 14 years ago #

    Hello

    I just saw that my website exists in two different ways: http://mydomain.com and http://www.mydomain.com

    What should I do to point the http://www.mydomain.com to the no-www version?

    Practicly if someone types the address with www I would like to redirect him to the no-www address. Thanks.

    PS:

    1 0 siteurl http://mydomain.com
    39 0 home http://mydomain.com

  2. counteragent
    Member
    Posted 14 years ago #

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

    Put this code in your .htaccess file in the root directory of the site and it should redirect any www's to non-www's.

About this Topic

  • Started 14 years ago by shobo
  • Latest reply from counteragent