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 server I host multiple sites on like http://this.example.com/site1, http://this.example.com/site2, http://this.example.com/site3. I am trying to add a secure site at https://this.example.com/site4. It's the only one I want to use the secure connection.

I set up everything and it seemed to work, but as soon as I visit https://this.example.com/site4 it redirects all my other sites to https until I clear browser cache. Is there a setting I can use to help keep the http traffic from redirecting to https? contents default-ssl config below.

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
    ServerAdmin webmaster@localhost

    ServerName this.example.com
    DocumentRoot /var/www/
    <Directory /var/www/site4>
            RackBaseURI /site4
            RackEnv production
            Options -MultiViews
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

    SSLEngine on
    SSLCertificateFile    /path/to/cert
    SSLCertificateKeyFile /path/to/key
    SSLCertificateChainFile /path/to/chain/file

    <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
            SSLOptions +StdEnvVars
    </Directory>

    BrowserMatch "MSIE [2-6]" \
            nokeepalive ssl-unclean-shutdown \
            downgrade-1.0 force-response-1.0
    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>
share|improve this question
    
You're sure it redirects you? I see no directive there that would cause a redirect by Apache. I did notice myself that when you type a host name in the Firefox address bar, it picks up earlier entries from history sometimes without me noticing and I experience similar result as what you are describing. Maybe try actually typing this.example.com to confirm. –  ETL Feb 18 '13 at 17:36
    
SSL is set up based on domain name, you don't really restrict to to a folder within the subdomain. From what I see, the three links you provide all seem to have the same domain. Is this correct? –  drone.ah Feb 19 '13 at 22:44
    
correct. The SSL cert is for this.example.com on which I've got /site1, /site2, and /site3 in a virtual host listening on port 80. /site4 is in the virtualhost replicated above listening on 443.It occurs to me, now that you mention it, that enabling of the ssl engine doesn't happen within the context of a virtualhost. Since files are just a logical separation and make no difference to the server that applies to the virtualhost on port 80, even htough it's in a different file. That sound about right? Is there a way to fix it? –  biagidp Feb 20 '13 at 14:12

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.