Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a vhost running on 443 and 80. On the 80 vhost I have a rule like this.

        Redirect permanent / https://localhost

I am testing serving a static page in /autos and I want this traffic to not use the redirect rule, i want this page to be served from the 80 vhost without SSL. So i tried setting a RewriteCond and then A RewriteRule for the cond.

        RewriteCond %https://localhost !/autos$
        RewriteRule !^/var/www/autos - [C]

this is not working cause im likely doing it wrong. Any tips?

share|improve this question
add comment

2 Answers

I'm using two vHost definitions - one for http and one for https. for plone I use this:

  RewriteEngine On
  RewriteRule ^/webalizer(.*) /webalizer$1 [PT]
  RewriteRule ^/(.*) http://127.0.0.1:9673/VirtualHostBase/http/www.domain.tld:80/zope/VirtualHostRoot/$1 [L,P]

but perhaps in the https-vHost this ist sufficent too:

Redirect permanent /autos http://www.domain.de/autos

hth

share|improve this answer
    
thanks for the response, these two options did not work for me. –  Joey BagODonuts Dec 2 '11 at 7:30
add comment

You have to possibilities:

1) Set up a redirect on you Port 80 VirtualHost that ignores the subfolder autos:

RewriteEngine On
RedirectMatch 301 ^((?!(autos)).)*$ https://your-domain.ain/

Note: This does not keep the path in the URL. So http://your-domain.ain/path/to/sth will be redirected to https://your-domain.ain/.

2) IMO the better Solution would be to create a own VirtualHost for the subfolder autos.

<VirtualHost *:80>
  ServerName autos.yourdomain.ain
  DocumentRoot /var/www/autos
  ServerAdmin name@domain.com

  # Write a seperate log per Virtualhost
  CustomLog /var/log/apache2/autos.access_log combined
  ErrorLog /var/log/apache2/autos.error_log

  # Maybe you want to put some restrictions on the directory
  <Directory /var/www/autos>
    Options -Indexes +FollowSymLinks + Includes
    AllowOverride All
    # Restrict Access to certain IP's (change IP to a real IP or comment out)
    Order Deny,Allow
    Deny from All
    Allow from 127.0.0.1 IP IP IP
    Satisfy ALL
  </Directory>
</VirtualHost>

You can find further information on Apache VirtualHosts and some examples in the Apache Manual.

EDIT: For the seperate VHOST you'll need to use NameVirtualHost. Make sure you have the following Entries in your Apache conf:

NameVirtualHost *:80
Listen 80
NameVirtualHost *:443
Listen 443
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.