PDA

View Full Version : How can I prevent the WWW version of my website from being displayed?


tmanran123
09-11-2011, 05:51 AM
Thanks for reading!

I'd simply like to prevent the www version of my vbulletin install from being accessible.

e.g. when a person goes to the www version of my forum URL, i'd like to have the www disappear and go to the non www version.

I guess I'd use the htaccess file??? Or do i use canonical tags?

Please help :confused:

Thanks

HMBeaty
09-11-2011, 11:07 PM
Add this to your .htaccess in your sites root directory. If you don't have one there, create one and add this to it:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]

Eric
09-12-2011, 01:22 AM
Also, be sure to update the URL in your admincp before making the change, or you may not be able to login (depending on cookie settings)

HMBeaty
09-12-2011, 01:31 AM
Also, be sure to update the URL in your admincp before making the change, or you may not be able to login (depending on cookie settings)
Yes, very true! Thank you :)

tmanran123
09-12-2011, 02:01 AM
Thanks guys

can you be more specific about:

"be sure to update the URL in your admincp"

what does this mean?

HMBeaty
09-12-2011, 02:14 AM
Thanks guys

can you be more specific about:

"be sure to update the URL in your admincp"

what does this mean?
Sure. When you navigate to:
AdminCP => Settings => Options => Site Name / URL / Contact Details => Forum URL
AdminCP => Settings => Options => Site Name / URL / Contact Details => Homepage URL
Make sure both of those settings do not contain the www.

For example, if you currently have http://www.yoursite.com, you need to change that to http://yoursite.com :)

tmanran123
09-12-2011, 03:47 AM
Yay it works

Thanks!!!!!!!!!!!!!!!

http://happy-pictures.net/wp-content/uploads/2011/09/Happy-Cat11.jpg

HMBeaty
09-12-2011, 03:55 AM
No problem :)

Max Taxable
09-12-2011, 11:46 AM
Just curious, but how is this different from the following?

RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://yourdomain.com/$1 [R=301,L]