View Full Version : How to redirect from non-www to www
ruberr2002
Nov 4th 2007, 9:28 pm
Hi
I have one pligg based site & wan to redirect from non-www to www, but
nothing worked. I searched the net & experimented with all the possible things in .htaccess. Currently this one is the code in .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^totalpad\.com
RewriteRule (.*) http://www.totalpad.com/$1 [R=301,L]
Could someone please help to resolve this. Thanks in advance.
viperxx
Nov 5th 2007, 3:05 am
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Where did you put the .htaccess file? Does apache have mod_rewrite enabled?
ruberr2002
Nov 5th 2007, 4:50 am
Where did you put the .htaccess file? Does apache have mod_rewrite enabled?
At the same time when this site went live. Yes, Apache have mod-rewrite enabled. Thanks
niknar1900
Nov 5th 2007, 4:53 am
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^/?$ http://www.domain.com [R=301,L]
this is how mine basically reads, hopefully it helps you.
(edited the names of course)
ruberr2002
Nov 5th 2007, 5:10 am
Thanks niknar1900, but it didn't help either.
niknar1900
Nov 5th 2007, 5:16 am
the first code i put up was wrong, the current code that is up works for a site of mine, just checking if you meant the latest one, good luck man! Wish you had Cpanel or maybe your hosting provider can help you.
ruberr2002
Nov 5th 2007, 5:31 am
the first code i put up was wrong, the current code that is up works for a site of mine, just checking if you meant the latest one, good luck man! Wish you had Cpanel or maybe your hosting provider can help you.
Noithing worked out. Probably I should talk to my hosting comapny. Thanks
Sebastian Rametta
Nov 13th 2007, 8:11 am
try putting just this in your .htaccess
asdfhasdfhkjsadfhlkj
And see what happens, it should error out, if it dosen't then your host probably does not have mod_rewrite enabled.
ruberr2002
Nov 13th 2007, 2:25 pm
Thanks, Sebastian Rametta. I solved this. Thanks
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.