apache - How to permanent redirect an HTTP to HTTPS SSL url? -


how can redirect incoming http requests local https configuration in apache2 on ubuntu?

the following not work, because localhost not replaced internal server ip.

<virtualhost *:80>         redirect / https://localhost </virtualhost>  <virtualhost *:443>        proxypass ... </virtualhost> 

is possible without having explicit hardcode local server ip redirect?

this should do:

<virtualhost *:80> ... rewriteengine on rewriterule ^ https://%{http_host}%{request_uri} [l,r=302]  </virtualhost> 

once sure works ok, change 302 301


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -