diff options
author | elijah <elijah@riseup.net> | 2014-04-24 01:10:21 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2014-04-24 01:10:21 -0700 |
commit | e53b2d02de7228f563a7187723477dd4dac20b99 (patch) | |
tree | 82f17d7c193b2882a3147177e7a45e0a302b842f /public/.htaccess | |
parent | f456ab77716ba5327f7f12d800123fbf3f857c7f (diff) |
rebuilt pages
Diffstat (limited to 'public/.htaccess')
-rw-r--r-- | public/.htaccess | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..68a245d --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,85 @@ +## +## AUTO NEGOTIATED LOCALE +## + +LanguagePriority en +ForceLanguagePriority Prefer Fallback +DirectoryIndex index +DirectorySlash Off +Options +MultiViews + +## +## REWRITES +## + +Options +FollowSymLinks +RewriteEngine On + +RewriteBase / + +## +## remove trailing slashes (except for paths where we added the slash) +## + +# /en/ => /en +RewriteCond %{QUERY_STRING} !end +RewriteRule ^([a-z]{2})/$ /$1 [R=307,L] + +# /en/aaa/ => /en/aaa +RewriteCond %{QUERY_STRING} !end +RewriteCond %{REQUEST_URI} ^/([a-z]{2})/ +RewriteCond %{REQUEST_URI} !\.html$ +RewriteRule ^(.+)/$ /$1 [R=307,L] + +# /foo/bar.en.html/ => /foo/bar +RewriteCond %{QUERY_STRING} !end +RewriteCond %{REQUEST_URI} \.html/$ +RewriteRule ^(.+)\.[a-z]{2}\.html/$ $1 [R=307,L] + +# /foo/bar/ => /foo/blah +RewriteCond %{QUERY_STRING} !end +RewriteRule ^(.+)/$ $1 [R=307,L] + +## +## rewrite all paths with a local prefix to use +## the appropriate index.{local}.html file or +## filename.{local}.html file. +## + +# /en => /index.en.html +RewriteCond %{QUERY_STRING} !end +RewriteCond %{DOCUMENT_ROOT}/index.$1.html -f +RewriteCond %{REQUEST_URI} ^/([a-z]{2})$ +RewriteRule ^(.*) /index.%1.html?end [L] + +# /en/aaa => /aaa/index.en.html +RewriteCond %{QUERY_STRING} !end +RewriteCond %{DOCUMENT_ROOT}/$2/index.$1.html -f +RewriteRule ^([a-z]{2})/(.*) /$2/index.$1.html?end [L] + +# /de/foo/bar => /foo/bar.de.html +RewriteCond %{QUERY_STRING} !end +RewriteCond %{DOCUMENT_ROOT}/$2.$1.html -f +RewriteRule ^([a-z]{2})/(.*) /$2.$1.html?end [L] + +## +## internally simulate a trailing slashes for directories in order +## to trigger DirectoryIndex and autonegotiated locale. +## + +# /foo/bar => /foo/bar/ +RewriteCond %{QUERY_STRING} !end +RewriteCond %{DOCUMENT_ROOT}/$1 -d +RewriteRule ^(.*[^/])$ /$1/?end [PT] + +## +## redirect assets that are locale prefixed +## (in order to allow relative paths) +## + +# e.g. /de/foo/assets/style.css => /foo/assets/style.css +RewriteCond %{QUERY_STRING} !end +RewriteCond %{DOCUMENT_ROOT}/$2 -f +RewriteRule ^([a-z]{2})/(.*) /$2 [R=307,L] + + |