Skip to content

Instantly share code, notes, and snippets.

@kneipp
Created May 8, 2015 02:21
Show Gist options
  • Save kneipp/3d206db99de9dd69f2c2 to your computer and use it in GitHub Desktop.
Save kneipp/3d206db99de9dd69f2c2 to your computer and use it in GitHub Desktop.
htaccess removing php extension keeping query string
# http://stackoverflow.com/questions/19050516/combine-htaccess-rules-remove-extension-and-rewrite-url-variables?rq=1
Options +FollowSymLinks -Indexes -MultiViews
RewriteEngine On
RewriteBase /subdirectory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?(.*)$ $1.php?_url=$2 [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment