Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How do I configure Apache to rewrite an http request for a subdomain to an https request for the correct directory?

For example, I have the following VirtualHost configuration:

virtualhost with rewrite

However, this turns into

Also, changing

RewriteRule ^(.*)$ https://%{HTTP_HOST}/redmine [R] to

RewriteRule ^(.*)$ https://%{HTTP_HOST} [R]

seems to simply redirect the HTTP request to HTTP://, which is currently the default /var/www/index.html page.

Any suggestions?

share|improve this question
Why the screenshot and not a pasted config? And you can use in your examples –  Dave Forgac Nov 11 '12 at 4:00

1 Answer 1

Try this:

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

share|improve this answer
The rewrite did not work, but I used a redirect like in the link you provided that is redirecting all requests to at the appropriate directory, and I added a virtualhost config in my default-ssl file that references ServerName to the DocumentRoot /var/www/redmine. However, I am having a new issue:… –  David Kaczynski Nov 11 '12 at 16:43

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.