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 am using this directive to redirect to HTTPS:

<VirtualHost *:80>
        ServerName              foo.bananas.net
        Redirect                301 / https://foo.bananas.net
</VirtualHost>

The problem is that when a path is used in the address bar, like http://bananas.net/webpage, it takes a pauses for a while before failing with https://bananas.netwebpage (no slash).

Should a rewrite rule be used instead? What should it be, and are there any differences in behaviour that I should be aware of?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You could use mod_rewrite, or you could use a RedirectMatch.

e.g. something like this:

RedirectMatch  301  ^(.*)  https://foo.bananas.net$1

on second thoughts, just add a "/" to the end of the Redirect rule you already have:

    Redirect  301  /  https://foo.bananas.net/

either should work.

share|improve this answer

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.