diff --git a/.htaccess b/.htaccess index 1920cfd..79bfb37 100644 --- a/.htaccess +++ b/.htaccess @@ -1,7 +1,13 @@ RewriteEngine On +# Force HTTPS (redirect HTTP to HTTPS) RewriteCond %{HTTPS} off -RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] +RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] + +# Redirect www to non-www (if you want to remove www) +RewriteCond %{HTTP_HOST} ^www\.(example\.com)$ [NC] +RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301] + RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/index\.php[\s?/] [NC]