Redirect domain.com to www.domain.com in Gallery 3
|
daholzer
Joined: 2013-05-17
Posts: 18 |
Posted: Thu, 2013-05-30 21:52
|
|
Hi I'm trying to do a redirect in .htaccess to redirect non wwww url request to the www version. I tried using this code:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
but what I get is domain.com redirecting to http://www.domian.com/index.php?kohana_uri= I should note that I have uncommented the section in .htacces that removes index.php. |
|

Posts: 79
RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]Posts: 18
Unfortunately Mike, that code gives me the exact same results as my code
Posts: 27300
Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo.
, so try:
I'm no rewrite
expertVodouisantRewriteEngine on RewriteCond %{HTTP_HOST} ^domain\.com RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 18
This didn't work either. It didn't seem to do any redirect at all.
Posts: 18
OK I figured it out if anyone is interested. The code that worked for me was
RewriteCond %{HTTP_HOST} ^domain\.com [NC] RewriteRule (.*) http://www.domain.com/$1 [R=301,L]You were pretty close Dave, just needed the [NC].
Posts: 27300
I missed that
spell pocientingredient. Now your the voodoo expert!Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team