Redirect your non www url's to www

Status
Not open for further replies.

hhhgame

Active Member
186
2009
0
0
In order to redirect all of the requests for yourdomain.com to www.yourdomain.com, you should set the appropriate rewrite rule. This can be done by adding the following lines at the beginning of the .htaccess file in your public_html folder

Code:
RewriteEngine on
RewriteBase /

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

After this successful step any non www url's gets redirected to www url's
 
11 comments
Just to let you know that you shouldn't do this lmao, www is considered as a subdomain and might give you more traffic since google will most likely index www links and non-www links :P
 
i cant see my .htaccess ? but if i search it,it appears on the search result


ok i solved my problem, anyone experiencing cant find the .httaccess, try to uncheck then check tha show hidden files dot files. :)


thanks for this btw,
 
Status
Not open for further replies.
Back
Top