DirectoryIndex index.php
Options -Indexes

RewriteEngine On

# Relative 404 path (Apache 2.4.13+) — same folder as this .htaccess
ErrorDocument 404 404.php

# Redirect .php URLs to extensionless, keeping the path from this request
# e.g. /about.php → /about
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC]
RewriteCond %{REQUEST_URI} !index\.php [NC]
RewriteRule ^ /%1 [R=301,L,QSA]

# /index → site home
RewriteRule ^index/?$ ./ [R=301,L]

# Legacy nested paths → flat pages (same as LocalValetDriver / router.php)
RewriteRule ^(?:solutions|talent|methodology|resources)/(.+?)/?$ /$1 [R=301,L]

# /about → about.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L,QSA]
