I want to remove forceful https,and redirect https:// to http://
My .htaccess in the webroot folder is as follows:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I have tried
<IfModule mod_rewrite.c>
#Redirect HTTPS to HTTP
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
But it’s not getting redirected.
Thanks in advance
2
Answers
i think you should force a http request from your AppController by changing it to something like this and check if it might help
Make sure you have the following line in httpd.conf (mod_rewrite support-enabled by default):
Now you just need to edit or create a file .htaccess in the root directory of your domain and add these lines to redirect http to https:
Now that the visitor is typing http://www.yourdomain.com, the server automatically redirects HTTP to HTTPS https://www.yourdomain.com
How to redirect HTTP to HTTPS on an Apache virtual host
In addition, to force all web traffic to use HTTPS, you can also configure your virtual host file. There are two important points about virtual host configuration if SSL certificate is enabled.
The first contains the configuration for non-secure port 80.
The second is for secure port 443. To redirect HTTP to HTTPS for all pages of your website, first open the appropriate virtual host file. Then change it by adding the configuration below:
After all the changes, don’t forget to restart the server.