apache - htaccess HTTPS only no redirect -


i want block port 80 (http) , allow https requests. have found many examples of how redirect http https prefer display error instead. cannot block port 80 in config file hosting provider not allow me modify these files. if possible, how can achieve same results htaccess.

the reason me wanting on api.domain.com added security after reading article.

quote article...

aside abandoning http basic altogether there easy fix. close port 80 on api host. stops connection being made dead in tracks, preventing credentials being sent in clear

try:

rewriteengine on rewritecond %{https} off rewritecond %{request_uri} !/error\.php rewriterule ^ http://%{http_host}/error.php [l,r] 

or

rewriteengine on rewritecond %{https} off rewriterule ^ - [l,f] 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -