as i am new to .htaccess, i couldn´t figure out how to make this work: On my webserver the default index.html (/var/www/) should be redirected to different other index.html regarding the time of the day and the browser language...
- /index.html (default, german, black background for the night)
- /i/index.html (german, white background for the day)
- /e/index.html (english, black background for the night)
- /e/i/index.html (english, white background for the day)
All pages are linked with each other, so that the user can jump between language and "style". Using only the time-condition it works for german, but how can i combine this with "english"? I tried this one, but it didn´t work...
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{TIME_HOUR} >07
RewriteCond %{TIME_HOUR} <16
RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteRule ^index\.html$ /e/i/index.html [L]
RewriteCond %{TIME_HOUR} >07
RewriteCond %{TIME_HOUR} <16
RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteRule ^index\.html$ /i/index.html [L]
RewriteCond %{TIME_HOUR} >16
RewriteCond %{TIME_HOUR} <07
RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteRule ^index\.html$ /e/index.html [L]
RewriteCond %{TIME_HOUR} >16
RewriteCond %{TIME_HOUR} <07
RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteRule ^index\.html$ /index.html [L]
Could somebody help please? Many Thanks!
I had to change the structure of the website, so i also changed the .htaccess file:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:Accept-Language} (de) [NC]
RewriteCond %{TIME_HOUR} >07
RewriteCond %{TIME_HOUR} <16
RewriteRule ^index\.html$ /d/i/index.html [L]
RewriteRule ^index\.html$ /d/index.html [L]
RewriteCond %{HTTP:Accept-Language} (en) [NC]
RewriteCond %{TIME_HOUR} >16
RewriteCond %{TIME_HOUR} <07
RewriteRule ^index\.html$ /e/i/index.html [L]
RewriteRule ^index\.html$ /e/index.html [L]
Now the time-condition for german works fine, but it seems that the english-condition is not even passed to the browser... Could somebody give me a hint, what could be the problem? Many thanks!