Skip to content

Instantly share code, notes, and snippets.

@leotm
Created December 6, 2016 23:55
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 leotm/d8a92b9ea8f8bbc7fd260561b8fea524 to your computer and use it in GitHub Desktop.
Save leotm/d8a92b9ea8f8bbc7fd260561b8fea524 to your computer and use it in GitHub Desktop.
Options +FollowSymLinks
RewriteEngine on
# beautiful addr/location bar
RewriteRule ^profile/(.*)/(.*)/?$ profile.php?id=$1&name=$2 [B]
# no need to see dem file ext.'s
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
# don't touch my git
RedirectMatch 404 /\.git
# disallow folder snoopin
Options All -Indexes
ErrorDocument 404 https://example.com/404
RewriteRule ^(http://example.com/)index$ http://example.com/ [R=301,L]
RewriteRule ^(http://example.com/)index.php$ http://example.com/ [R=301,L]
RewriteRule ^(https://example.com/)index$ https://example.com/ [R=301,L]
RewriteRule ^(https://example.com/)index.php$ https://example.com/ [R=301,L]
# e.g. inc/
deny from all
# best/simple
Require local
# meh
Require ip 127.0.0.1
Require ip ::1
# u old
Order deny,allow
Deny from all
Allow from ::1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment