0

We have a web server that can handle SSL requests, but on port 445 instead of 443. So https://domain.com doesn't work, but https://domain.com:445 does.

How can I use .htaccess to issue a redirect to port 445, without issuing a 301?

I tried using %{HTTPS} on but it didn't work.

I dont want redirect HTTP to HTTPS. Just https://domain.com to https://domain.com:445 without 301

2 Answers 2

1

Why do you want it on another port, yet catch standard https://hostname.domain/path urls? Wouldn't it be a lot easier to simply listen on port 443?

2
  • You have right. But i don't think we can do that(no access). There is no way to do this in htaccess? If it's impossible then where we can change port? I'm asking for sure, because we have access to something like net admin where we can't do to many and we have access on ftp only to public_html ..
    – John Smit
    Mar 26, 2013 at 9:38
  • There's no way to that with .htaccess, but if you can't fix the problem then you could simply put a router in front to remap the port (e.g. Linux using iptables).
    – symcbean
    Mar 28, 2013 at 10:14
1

You're likely going to wind up with a problem where browsers want to negotiate SSL and pop warnings when accessing https://domain.com/ before even getting to the redirect.

You've also got to have some kind of 3xx status code because that's how HTTP works, so I assume you're after a 302.

Bearing in mind the above to points something like this might work:

RewriteCond %{SERVER_PORT} ^443$  
RewriteRule .* https://%{SERVER_NAME}:445%{REQUEST_URI} [R=302,L]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .