# mod_rewrite starts here RewriteEngine on # Prevent directory listings Options All -Indexes # does not apply to existing directories, meaning that if the folder exists on the server then don't change anything and don't run the Rule! RewriteCond %{REQEUSTED_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html [NC,L] RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php [NC,L] ErrorDocument 404 /404 ErrorDocument 403 /403 order allow,deny deny from all