Fix htaccess

This commit is contained in:
edsea
2025-08-03 02:48:35 +02:00
parent 9634a3ea80
commit 20b56efd31

View File

@@ -1,19 +1,19 @@
# Enable the RewriteEngine
RewriteEngine On RewriteEngine On
RewriteCond %{REQUEST_URI} !(/$|\.)
# Force HTTPS (redirect HTTP to HTTPS) RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
RewriteCond %{HTTPS} off
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]
# Redirect URLs without trailing slashes (except index.php) to URLs with trailing slashes
RewriteCond %{REQUEST_URI} !/index.php$
RewriteRule ^([^/]+)$ /$1/ [L,R=301]
# 404
ErrorDocument 404 /404
# Rewrite any single-word URL with a trailing slash like /about/ to index.php?page=about
RewriteRule ^([^/]+)/$ index.php?page=$1 [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/index\.php[\s?/] [NC]
RewriteRule ^index\.php$ / [R=301,L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)/?$ $1.php [L]
# Enable GZip compression # Enable GZip compression
<IfModule mod_deflate.c> <IfModule mod_deflate.c>
@@ -36,4 +36,4 @@ RewriteRule ^([^/]+)/?$ $1.php [L]
<IfModule lsapi_module> <IfModule lsapi_module>
php_value output_buffering Off php_value output_buffering Off
</IfModule> </IfModule>
# END cPanel-generated php ini directives, do not edit # END cPanel-generated php ini directives, do not edit