Trying to redirect my website from http to https, but its not working... website opens on both http and https.
This is the code section presently i used in my htaccess file, but this code not auto redirecting the website with https, and making the website open with both http and https. which is confusing so much.
------------------------------------------------
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteCond %{HTTP_HOST} ^www\.surffares\.com$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "https\:\/\/www\.surffares\.com\/" [R=301,L]
------------------------------------------------------------------------
but this code is not working ...
This is code godaddy suggested to use in htaccess for auto redirect, but this code only loading the front page, auto redirecting the front page only but no other page is opening, when i click any other page, it shows me a error not found.
---------------------------------------------------------------------
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?coolexample\.com
RewriteRule ^(.*)$ https://www.coolexample.com/$1 [R,L]
--------------------------------------------------------------------
Godaddy Customer support told you need to pull inner pages in .htaccess.
How i can auto redirect my website from http to https and also pull all the inner pages of the website.
NOTE: my website is in php mvc laravel
I've quickly built a configuration to test this scenario. In Apache VirtualHost you need to make sure that htaccess-files are respected by apache with AllowOverride.
Here is the configuration within the VirtualHost:
<VirtualHost *:80>
ServerName test.com
DocumentRoot /var/www
<Directory "/var/www>
Require all granted
AllowOverride all
</Directory
</VirtualHost>
Then, in /var/www/.htaccess, define the following:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
Hope that helps.
Jo