Skip to content

Instantly share code, notes, and snippets.

@mapkyca
Created January 26, 2012 10:49
Show Gist options
  • Save mapkyca/1682208 to your computer and use it in GitHub Desktop.
Save mapkyca/1682208 to your computer and use it in GitHub Desktop.
Apache mod_rewrite rule to pass requests to a PHP page handler, but only if the file or folder doesn't physically exist.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ path/to/pagehandler.php?page=$1 [QSA]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment