Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to know if it is possible via htaccess to rewrite my URL to

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

share|improve this question
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

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.