Re: non-www to www redirect works with a little issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This works for us.

RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule .* http://www.example.com%{REQUEST_URI} [R=301,L]

On Fri, May 25, 2012 at 6:53 AM, J. Bakshi <joydeep@xxxxxxxxxxxxxxx> wrote:
> Hello,
>
> 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.
>
> What modification should I add here to make it work ?
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux