Re: apache redirection does not work

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

 



The issue with creating ServerAlias is we get two analytics reports for each of our site. There are many benefits associated with redirecting non 'www' urls to 'www' urls.

I tried using following configuration in httpd.conf as per Bob recommendation.


Rewritelog logs/rewrite_log
Rewriteloglevel 6


It created file rewrite_log but did not write any thing in the log file. I have also tried using QSA flag to the rule but that didn't work either.


Thanks,
Sharjeel

On Thu, Oct 1, 2009 at 5:06 PM, Martin Spinassi <martins.listz@xxxxxxxxx> wrote:
On Thu, 2009-10-01 at 11:53 -0400, Sharjeel Tariq wrote:
> Hi,
>
>
> I am trying to set up apache redirection rule for redirecting all of
> our non
> 'www' domains to 'www' domains. I got the redirection rule from apache
> manual
> but the rule does not work when we have subdirectories and parameters
> at the
> end of url.
>
> The redirection rule i have is
>
>
> RewriteCond %{HTTP_HOST} ^example.com$
> RewriteRule ^/(.*)$ http://www.example.com/$1 [L,R]
>
<snip>

Sharjeel,

I know it's not what you are asking for, but may accomplish your task.

You can try adding a ServerAlias to the VirtualHost:

ServerName example.com
ServerAlias www.example.com

Here is the documentation at apache site:
http://httpd.apache.org/docs/2.0/mod/core.html#serveralias


Sorry if it's not what you are asking for, but it's pretty much waht I'd
do. With a simple script you can manage to add the ServerAlias to all
the VirtualHosts.


Cheers,

Martin


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-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