Skip to content

Instantly share code, notes, and snippets.

@litzinger
Created February 29, 2012 19:10
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 litzinger/1943617 to your computer and use it in GitHub Desktop.
Save litzinger/1943617 to your computer and use it in GitHub Desktop.
Add trailing slashes
# Add trailing slashes unless it's a file or has a query string.
RewriteCond %{THE_REQUEST} ^GET
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1/ [L,R=301]
# Do our rewrites
RewriteBase "/"
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment