Quantcast
Viewing all articles
Browse latest Browse all 4

Answer by Talal Al-Khalifa for Using htaccess to force HTTPS doesn't work

You must activate the option AllowOverride All to use .htaccess file. Also, you can add the Rewrite rules inside the Directory in the conf file like the below example or on your .htaccess file.

<Directory "/srv/www/htdocs">Options -Indexes +FollowSymLinksAllowOverride AllRewriteEngine onRewriteCond %{SERVER_NAME} =example.com  [OR]RewriteCond %{SERVER_NAME} =www.example.com RewriteRule ^https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]Require all granted</Directory>

I have changed my Directory in Conf file to only:

<Directory "/srv/www/htdocs">  AllowOverride All  Require all granted</Directory> 

And inserted in .htaccess the following only:

RewriteEngine onRewriteCond %{SERVER_NAME} =www.example.comRewriteRule ^https://www.example.com%{REQUEST_URI} [END,NE,R=permanent]

So If this don't work contact your host to add AllowOverride All only.


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>