redirect - Redirecting HTTP to HTTPS with Apache -
i have issue using mod_rewrite force redirection of http requests https using apache 2.2.22 on ubuntu server 12.04.
my /etc/apache2/sites-available/default file follows:
<virtualhost *:80> rewriteengine on rewritecond %{server_port} !^443$ rewriterule ^/(.*) https://%{http_host}/$1 [nc,r,l] </virtualhost>
the https host defined in default-ssl in same directory.
visiting server's local ip address, redirect appears work fine. however, accessing via fqdn, doesn't. using fqdn, site available @ port 5443, mapped in firewall 443 on server, perhaps has problem. cannot use port 443 directly, in use on ip address server.
to further clarify, following valid links:
https://website:5443 https://192.168.200.80:443
the redirect works here:
http://192.168.200.80
but following gives 400 bad request, , redirect needed:
http://website:5443/
"your browser sent request server not understand. reason: you're speaking plain http ssl-enabled server port. instead use https scheme access url, please."
this totally possible. following redirects http https url.
<virtualhost *:80> servername mydomainname.com rewriteengine on rewritecond %{https} off rewriterule (.*) https://%{http_host}%{request_uri} </virtualhost>
make sure load rewrite module mod_rewrite , enable it.
Comments
Post a Comment