Fix htaccess
This commit is contained in:
24
.htaccess
24
.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
|
||||
<IfModule mod_deflate.c>
|
||||
|
||||
Reference in New Issue
Block a user