Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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 ^/(.*)$1 [L,P]

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

Redirect permanent /autos


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

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

  # 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 IP IP IP
    Satisfy ALL

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

Your Answer


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.