Alias "Clean" URLs - .htaccess

RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^([^.]+)$ $1.php [NC,L]

1 Response

This snippet lets you use "clean URLs" -- those without a PHP extension, e.g. example.com/users instead of example.com/users.php.

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.