Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

URL rewriting

View gist:874000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# Why rewrite URLs? Read this: http://en.wikipedia.org/wiki/Rewrite_engine
 
# Apache (.htaccess or httpd.conf)
# Make sure AllowOverride is on for the directory, or put the rewrite rules in httpd.conf
# http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
 
# Nginx (nginx.conf)
try_files $uri /index.php;
 
# More reading:
- http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
- http://wiki.nginx.org/HttpRewriteModule
- http://wiki.nginx.org/Pitfalls
 
Note: Thanks to James (http://github.com/jamesvl) for his improvements and fixes (http://gist.github.com/910325)

#Lighttpd Rewrite
url.rewrite-once = ( "/(.*)" => "/index.php/$1" )

Using XAMPP for development, I was getting thrown to its splash page any time I attempted to add params to my URL. Removing the leading slash in front of index.php in the RewriteRule resolved this. Modified rule follows.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L] 

Note: This is while using XAMPP in development using klein.php to route in an application that was not in the DocumentRoot. See Gist: https://gist.github.com/910325 for help with dispatching in this scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.