Take the 2-minute tour ×

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 http://redmine...us into https://redmine...us/redmine.

Also, changing

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

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

seems to simply redirect the HTTP request to HTTP://...us, 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 example.com/net/org in your examples tools.ietf.org/rfc/rfc2606.txt –  Dave Forgac Nov 11 '12 at 4:00
add comment

1 Answer

Try this:

RewriteEngine On
RewriteCond %{HTTPS} off


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

Your Answer


