From 20b56efd31d77253303b17f0393c362c013fefb1 Mon Sep 17 00:00:00 2001 From: edsea Date: Sun, 3 Aug 2025 02:48:35 +0200 Subject: [PATCH] Fix htaccess --- .htaccess | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.htaccess b/.htaccess index 79bfb37..05756d2 100644 --- a/.htaccess +++ b/.htaccess @@ -1,19 +1,19 @@ +# Enable the RewriteEngine RewriteEngine On - -# Force HTTPS (redirect HTTP to HTTPS) -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] +RewriteCond %{REQUEST_URI} !(/$|\.) +RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] +# 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 @@ -36,4 +36,4 @@ RewriteRule ^([^/]+)/?$ $1.php [L] php_value output_buffering Off -# END cPanel-generated php ini directives, do not edit \ No newline at end of file +# END cPanel-generated php ini directives, do not edit