33817-dev/.htaccess
2025-09-02 12:49:10 +00:00

20 lines
536 B
ApacheConf

DirectoryIndex index.php index.html
Options -Indexes
Options -MultiViews
RewriteEngine On
# 1) Canonical: /page.php -> /page (redirect)
RewriteCond %{THE_REQUEST} \s/+(.+)\.php[?\s] [NC]
RewriteRule ^ %1 [R=301,L]
# 2) Internal map: /page -> /page.php (if file exists)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L]
# Optional: strip trailing slash for non-directories
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [R=301,L]