Skip to content

Instantly share code, notes, and snippets.

@pablodgonzalez
Created November 17, 2015 23:29
Show Gist options
  • Save pablodgonzalez/31c79b219dfdb7e46037 to your computer and use it in GitHub Desktop.
Save pablodgonzalez/31c79b219dfdb7e46037 to your computer and use it in GitHub Desktop.
spa tips
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Redirect http://www. to just http://
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=
RewriteCond %{HTTP_HOST} ^touchtyping.guru [NC]
RewriteRule ^ snapshots%{REQUEST_URI}-en.html [L]
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=
RewriteCond %{HTTP_HOST} ^(es|pl|en).touchtyping.guru [NC]
RewriteRule ^ snapshots%{REQUEST_URI}-%1.html [L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [QSA,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment