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 want to know if it is possible via htaccess to rewrite my URL http://mysite.com:5553 to https://mysite.com:5553.

My Apache server has only one virtualhost on port 5553, with SSL on.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Running http and https on the same port won't work. Although the client will know whether it's speaking SSL or not, Apache will expect one or the other and will not detect which one is being spoken by the client.

This will result in HTTP 400 response codes in response to whichever one Apache was not expecting.

If you put them on different ports and use a separate vhost for the SSL and non-SSL requests, it certainly is possible to respond to http requests with a redirect response telling the client to make a new https request. It will not be possible to rewrite an http request into an https request.

share|improve this answer
    
ok thanks for this great explanation ! –  Clabman Mar 28 '12 at 12:11
add comment

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.