Hi!
I have rewrite conditions in my htaccess but since I am using boost they are ignored. The function was that the user was redirected based on browser language. But now the default language is loaded regardless of the browser language.
My referred htaccess part:
### LANGUAGE NEGOTIOATION ###
RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteRule ^$ /de [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^hu [NC]
RewriteRule ^$ /hu [L,R=301]
### LANGUAGE NEGOTIOATION END ###
### BOOST START ###
# Allow for alt paths to be set via htaccess rules; allows for cached variants (future mobile support)
RewriteRule .* - [E=boostpath:normal]
# Caching for anonymous users
# Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add|comment/reply))|(/(edit|user|user/(login|password|register))$) [OR]
RewriteCond %{HTTPS} on [OR]
RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [S=5]
# GZIP
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=2]
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html,E=no-gzip:1]
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml\.gz -s
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml\.gz [L,T=text/xml,E=no-gzip:1]
# NORMAL
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml -s
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml [L,T=text/xml]
### BOOST END ###
Any help appreciated!
Comments
Comment #1
bgm commentedI might be mistaking, but if I recall correctly, if you don't have a RewriteBase /, you should use "^/$" as your RewriteRule expression.
Ex:
I tested locally, and ^$ didn't work for me either, ^/$ did. My boost rewriterules are in my Apache vhost.
If that works for you, could you document a snippet in the Boost 7.x-1.x handbook? (might be good to create a new sub-page specific to i18n tricks)
Thanks
Comment #2
hefterbrumi commentedHi!
I used the same before (^$ ) but without boost and worked perfectly.
But thanks I will give it a try
No this doesnt work for me. I am sure that boost "overwrites" my rewrite rules. But I dont know how... I am on a shared server by the way
Comment #3
bgm commentedYou can enable mod_rewrite debugging to see the trace of what is happening.
Boost doesn't do anything other than what it says in the htaccess. It's at the Apache level anyway. Hard to debug since I can't reproduce on a sandbox.
Comment #4
hefterbrumi commentedOk I found out if I use it like this according to this method:
... it works. Please confirm and it can go to the handbook...
Comment #5
Anonymous (not verified) commentedHi, this issue was solved with caveats by mikeytown2 and others on this thread #768930: Drupal 6: Language fallback, browser detection but there are some side issues that should be read through, like some people getting stuck in one language side of the site forever. That was a version 6 thread which required some core code hacking.
However there are other solutions to the problem depending on the module being used for the language in particular this comment at the end #768930-28: Drupal 6: Language fallback, browser detection and this comment http://eureka.ykyuen.info/2011/06/19/drupal-force-path-prefix-for-defaul... by "outsourcer" changed one text box in D7 admin rather than hacking any code.