views:

39

answers:

2

On mydomain.com, I currently keep all of my apache conf files in:

/etc/httpd/conf.d/

In there I have a file called alwaysHttps.conf that contains:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

I have a bunch of virtualhosts, and for one domain on the site: myotherdomain.com I would like to turn off the auto redirect. Is it possible to setup an exception to the redirect to https, rather than having to get rid of the global alwaysHttps.conf?

<VirtualHost *:80> 
    DocumentRoot /home/webadmin/myotherdomain.com/html 
    ServerName myotherdomain.com 
    CustomLog "/home/webadmin/myotherdomain.com/access_log" "combined" 
    ErrorLog "/home/webadmin/myotherdomain.com/error_log" 
    <Directory /home/webadmin/myotherdomain.com/html> 
        Options Includes FollowSymLinks 
        AllowOverride All 
    </Directory> 
</VirtualHost> 
+1  A: 
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !myotherdomain\.com
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA]
Wrikken
OK - perfect! Thanks...That solves the redirect issue, but now I am getting 404s. My conf file for the domain is:If I leave off your fix and change the :80 to :443 pages the pages load. But the way it is now, they don't. Any quick thoughts?
John
Wrikken
A: 

Fantastic!

In my http.conf I have:

NameVirtualHost  *:80
NameVirtualHost  *:443

Listen 8033

The reason for the listen on 8033 was because I am using OpenVPN's feature to dual use port 80. Once I changed my

<VirtualHost *:80>  to 
<VirtualHost *:8033> 

everything worked.

The curious thing though is why all of my other virtual domains and *.conf files work even though they have

<VirtualHost *:80> 

and not

<VirtualHost *:8033>. 

Any idea why that would be the case?

John
I tried to leave this as a comment, but the button wasn't visible...
John