Re: [OT] non-www to www redirect works with a little issue
On Fri, 25 May 2012 17:05:44 +0530, J. Bakshi wrote:
> I have place the following in my .htaccess to redirect non-www to www
> redirection
>
> `````````````
> RewriteCond %{HTTP_HOST} ^example\.com$
> RewriteRule ^(.*) http://www.example.com/$1 [R=301]
>
> ```````````````
>
> The redirect work well but a little hitch. Say If I visit
> http://example.com/page1.html it redirect to http://www.example.com so
> at the home page. Where it should append the www before the link, but
> not alter the link.
So you basically want to redirect just the root and keep the subdirs...
> What modification should I add here to make it work ?
Maybe something like this:
http://serverfault.com/questions/388421/root-only-redirect-using-htaccess
Greetings,
--
Camaleón
Reply to: