Skip to content

Commit

Permalink
Added 'lang_list' option in vhost file to redirect on home page witho…
Browse files Browse the repository at this point in the history
…ut going through

Zena.
  • Loading branch information
gaspard committed Sep 7, 2012
1 parent 0836fe1 commit a024d58
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/zena/deploy/vhost.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]

<% list = (config[:lang_list] || 'en').split(',').map(&:strip)
last = list.last
list.each do |l|
if l != last %>
# Browser wants "<%= l %>" as favorite language
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP:Accept-Language} ^<%= l %>
RewriteRule ^.*$ /<%= l %> [R,L]
<% else %>
# Default language for website is "<%= l %>"
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^.*$ /<%= l %> [R,L]
<% end
end %>

# Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]

Expand Down

0 comments on commit a024d58

Please sign in to comment.