Skip to content

Instantly share code, notes, and snippets.

@grayghostvisuals
Last active December 15, 2015 19:19
Show Gist options
  • Select an option

  • Save grayghostvisuals/5310382 to your computer and use it in GitHub Desktop.

Select an option

Save grayghostvisuals/5310382 to your computer and use it in GitHub Desktop.
strip the .php extension using .htaccess trickery for Apache
# ------------------------------------------------------
# strip .php files of file extension
# ------------------------------------------------------
# rewrite strictly for files ending in .php
# Instead of your sites files as this => domain-name.com/file.php
# Rewrite so users can do this instead => domain-name.com/file
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment