Skip to content

Instantly share code, notes, and snippets.

@ipang-dwi
Created January 19, 2020 13:58
Show Gist options
  • Save ipang-dwi/e919295b12b8f03546d8e895de0780ac to your computer and use it in GitHub Desktop.
Save ipang-dwi/e919295b12b8f03546d8e895de0780ac to your computer and use it in GitHub Desktop.
htaccess to hide .php extension
RewriteEngine On
# turn on the mod_rewrite engine
RewriteCond %{REQUEST_FILENAME}.php -f
# IF the request filename with .php extension is a file which exists
RewriteCond %{REQUEST_URI} !/$
# AND the request is not for a directory
RewriteRule (.*) $1\\.php [L]
# redirect to the php script with the requested filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment