I want that if someone visits http://domain.com that he is redirected to https://domain.com
The .htaccess
file is located at /var/www/html
with the following content
<ifmodule mod_rewrite.c="">
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</ifmodule>
My apache2.conf
contains:
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride All
Require all granted
SSLRequireSSL
</Directory>
But it does not work, displaying:
Forbidden You don't have permission to access / on this server.
Edit: I removed the SSLRequireSSL line and disabled the cache in Firefox that saves redirections. If I visit http://domain.com it redirects me to https://domain.com. But still it does not do it for subdirectories as well. If I visit http://domain.com/sub I want to be redirected to https://domain.com