[users@httpd] mod_rewrite question(s)

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

 



I've been trying to use mod_rewrite to have http calls on a couple of directories and either all .php or one specific .php file rewritten as https calls.

I have been able to use <directory successfully to get the directories to rewrite but I cannot for the life of me get a rewrite of

http://www.domain.com/xxxx.php to rewrite to https://www.domain.com/xxxx.php

I am finding out just how tricky mod_rewrite and regular expressions can be.

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.


Any help is greatly appreciated!

Cheers
Steve Blandford




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