Skip to content

Instantly share code, notes, and snippets.

@philsturgeon
Created April 30, 2010 13:45
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 philsturgeon/385220 to your computer and use it in GitHub Desktop.
Save philsturgeon/385220 to your computer and use it in GitHub Desktop.
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
# NOTICE: If you get a 404 play with combinations of the following commented out lines
#AllowOverride All
#RewriteBase /wherever/ci/is
# Keep people out of codeigniter directory and Git/Mercurial data
RedirectMatch 403 ^/(application\/cache|codeigniter|\.git|\.hg).*$
# Send request via index.php (again, not if its a real file or folder)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
</IfModule>
@KushalP
Copy link

KushalP commented Apr 30, 2010

What about hiding .svn folders as well? ;)

@philsturgeon
Copy link
Author

Huh, .svn? What is this crazy old tech you speak of?

I avoided that as it would need another rule, .svn could be any damn place within the web directory, not just at the root level.

@KushalP
Copy link

KushalP commented Apr 30, 2010

If that's how you feel about svn, then enjoy this:

RewriteRule ^.svn/(.*)$ http://git-scm.com/ [R]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment