: Redirect to http://mydomain.com rather than http://www.mydomain.com I created a website and I would like when I put any link pointing to my website, the "www" to be removed. For example when
I created a website and I would like when I put any link pointing to my website, the "www" to be removed.
For example when someone enters www.mydomain.com/users into the browser address, this to be changed into mydomain.com/users when the page loads up.
I have seen this happening with twitter. if you try to go to www.twitter.com/john it will automatically remove the "www" and change the address to twitter.com/john .
However, this does not happen for www.facebook.com/john.
I am not sure if this have something to do with the domain's configuration (CNAME record?) but any point / tip to the right direction will be really appreciated!
More posts by @Angie530
1 Comments
Sorted by latest first Latest Oldest Best
You can use a simple HTTP redirect to remove the "www". Twitter for example uses a HTTP 302 (Moved temporarily) redirect to point www.twitter.com to twitter.com (and then a HTTP 301 (Moved permanently) to redirect to twitter.com).
Depending on your web server, there should be configuration options for this. In Apache, for example, you'd add the following to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$ [NC]
RewriteRule ^(.*)$ domain.com/ [R=301,L]
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.