Skip to content

Instantly share code, notes, and snippets.

@joesavage
Last active December 29, 2015 04:18
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 joesavage/7613586 to your computer and use it in GitHub Desktop.
Save joesavage/7613586 to your computer and use it in GitHub Desktop.
# Basic Rewrites
location ~ ^(.*/)index(\.html)?$ { return 301 $scheme://$host$1; }
location ~ ^(/.+)\.html$ { return 301 $scheme://$host$1; }
location ~ /$ {
# 'try_files' > 'index', to avoid re-write/location rules.
try_files $request_uri/index.html $request_uri/index.php =404;
}
try_files $uri.html $uri/ =404;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment