Re: [users@httpd] mod_rewrite question(s)

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

 



On 6/29/05, Steve Blandford <steve.blandford@xxxxxxxxxxxx> wrote:
> Another problem I am seeing is even though I have logging turned on in
> my conf file, and that the log file was created, nothing has been
> written to it...
> 
> Here is the portion of my conf file relating to the problem. (domain
> names have been changed to protect the innocent)
> 
>         #    ServerName dummy-host.example.com
>         #    ErrorLog logs/dummy-host.example.com-error_log
>         #    CustomLog logs/dummy-host.example.com-access_log common
>         #</VirtualHost>
> 
>         RewriteEngine On
> 
> 
>         NameVirtualHost 10.0.0.3:80
> 
>         <VirtualHost 10.0.0.3:80>
>             DocumentRoot /var/www/v1.domain.com/html/public
>             ServerName www.domain.com
>             RewriteLog "/var/log/httpd/rewrite_log"
>             RewriteLogLevel 8
>             ServerAlias *.domain.com *.domain.co.uk
>             Alias /merchant /var/www/v1.domain.com/html/merchant
>             Alias /admin /var/www/v1.domain.com/html/admin
>             ScriptAlias /cgi-bin /var/www/v1.domain.com/cgi-bin
>             ErrorLog /var/log/httpd/domain.com-error_log
>             CustomLog /var/log/httpd/domain.com-access_log common
>         </VirtualHost>
> 
>         # 1
>         <Directory "/var/www/v1.domain.com/html/admin">
>             Options FollowSymLinks
>             AllowOverride All
>             RewriteCond %{HTTPS} !=on
>             RewriteRule ^/(.*) https://%www.domain.com/$1 [R]
>         </Directory>
> 
>         #2
>         <Directory "/var/www/v1.domain.com/html/merchant">
>             Options FollowSymLinks
>             AllowOverride All
>             RewriteCond %{HTTPS} !=on
>             RewriteRule ^/(.*) https://%www.domain.com/$1 [R]
>         </Directory>
> 
>         <Directory "/var/www/v1.domain.com/cgi-bin">
>           SetHandler perl-script
>           PerlResponseHandler ModPerl::Registry
>           PerlOptions +ParseHeaders
>           Options +ExecCGI
>         </Directory>
> 
> The #1 and #2 ones work. currently. They take any request that is not
> https and convert it to https.

I very much doubt that they are working like you think.  Probably some
other configuration is having that effect.  I see several problems:
1. No "RewriteEngine On", which could explain why you have nothing in
your RewriteLog.
2. What is the "%" sign doing in the target URL?
3. When inside <Directory> sections, the URL you are matching against
generally doesn't have a leading slash.  I always find it much simpler
to keep my RewriteRules out of <Directory> sections and just put the
directory in the RewriteRule itself, as in

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/merchant(.*) https://%www.domain.com/merchant$1

Joshua.

---------------------------------------------------------------------
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