Skip to content

Instantly share code, notes, and snippets.

@SgtPooki
Created March 19, 2014 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SgtPooki/9653153 to your computer and use it in GitHub Desktop.
Save SgtPooki/9653153 to your computer and use it in GitHub Desktop.
remove .php
# Apache Rewrite Rules
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
#RewriteLog /var/rewrite.log RewriteLogLevel 9
# Redirect to URL without extension. (remove .php)
RewriteCond %{THE_REQUEST} ^[A-Z]+\s.+\.php\sHTTP/.+
RewriteRule ^(.+)\.php $1 [R=301,L]
# Internally attach .php to any requests that
# are not a directory or file, so that the correct file is served.
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [L]
</IfModule>
# End of Apache Rewrite Rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment