RewriteEngine On # 0) Echte Dateien und Ordner direkt ausliefern RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] # 1) /foo/bar -> foo/bar.php # Nur wenn REQUEST_FILENAME KEIN Verzeichnis ist (!!) RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.+?)/?$ $1.php [L] # 2) /foo/bar -> foo/bar/index.php # Wieder nur wenn KEIN Verzeichnis (!!) RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}/index.php -f RewriteRule ^(.+?)/?$ $1/index.php [L] # 3) Wenn nichts passt -> nichts rewrite’n → Apache liefert normalen 404