0

What is the code to be added to Redirect from http to https in .htaccess file?

here is the existing code in .htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/NextNext/
RewriteRule ^(.*)$ /public/$1 [L]
</IfModule>

awaiting your help..

  • Please check for existing answers before asking your question. Look into the "Related" section on the right hand side of this page. I am sure you will find what is needed. For example that one: https://stackoverflow.com/questions/12999910/https-to-http-redirect-using-htaccess?rq=1 – arkascha Apr 11 '20 at 13:00
  • Does this answer your question? [htaccess redirect to https://www](https://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www) – dspencer Apr 13 '20 at 07:50

1 Answers1

0

Try this rule after RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
JarekBaran
  • 1,156
  • 2
  • 5
  • 10