[Tut]Removing (www.) from your domain[.Htaccess]

Status
Not open for further replies.

Legion

Gaming Lord
Staff member
Nov 23, 2011
1,801
669
Well, say you own a VPS and you've updated your nameservers and nothing is working! You can only access yoursite at instead of yourdomain.com

here is a way to fix
Code:
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
or. You would like to force the www. use this code
Code:
# RewriteCond %{HTTP_HOST} !^www\.
# RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

No credits to me. Simple .htaccess tools
 

Qodex

Member
Feb 9, 2012
374
36
nice job! i tried to go on a retro and all the hrefs were site.com and not and it was really annoying keep having to put the www. in so sites lie them should use them! liked
 
Status
Not open for further replies.

Users who are viewing this thread

Top