warmseal-roofing/htaccess
2025-05-14 16:03:44 +01:00

10 lines
342 B
Plaintext

RewriteEngine On
# Redirect requests for .php files to the same URL without .php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.php [NC]
RewriteRule ^ /%1 [L,R=301]
# Internally rewrite requests without .php to the actual .php file
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.+)$ $1.php [L]