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.

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
1  
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

1 Answer 1

Try this:

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

http://www.cyberciti.biz/tips/howto-apache-force-https-secure-connections.html

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

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.