php - SSL and .htaccess redirect -


i developing website has ssl certificate applied it! want people visiting site https , not http.

i have been able achieve with...

<ifmodule mod_rewrite.c>   rewriteengine on    rewritecond   %{https}    off   rewriterule   (.*)     https://%{http_host}%{request_uri}  </ifmodule> 

but default www.mysite.co.uk , not mysite.co.uk automatically! able remove index.php using this...

rewritecond %{the_request} ^[a-z]{3,9}\ /(.*)index\.php($|\ |\?) rewriterule ^ /%1 [r=301,l] 

but stumped on www. bit! gratefully appreciated! - phillip dews

<ifmodule mod_rewrite.c>     rewritecond %{http_host} ^mysite.co.uk     rewriterule   (.*)     https://www.%{http_host}%{request_uri}      rewritecond   %{https}    off     rewritecond %{http_host} ^mysite.co.uk     rewriterule   (.*)     https://%{http_host}%{request_uri} </ifmodule> 

this make sure have www , https in url. can test at: http://htaccess.madewithlove.be/


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -