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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.