DAve
5th July 2005, 23:04
Goal: trying to get xhtml standards browsers to accept xhtml serves web-pages (specifically the GUNS webpage)
That is, firefox, mozilla and opera browsers to recognise the xhtml1.1 as application xml+xhtml and use the fallback IE as html tag soup. Stuff 'em :)
So, the original .htaccess file was sniffing for user agents. I really wanted to avoid this, but couldn't see any way around this. The file is below (well, te important parts anyway.
AddType text/html;charset=utf-8 .html
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} Opera [OR]
RewriteCond %{HTTP_USER_AGENT} Gecko [OR]
RewriteCond %{HTTP_USER_AGENT} Konqueror [OR]
RewriteCond %{HTTP_USER_AGENT} KHTML
RewriteRule \.html$ - [T=application/xhtml+xml]
So reading about the mess that user agents sniffers cause on the web, I learned about http_accept rules. They seem much better, and actually work on what the browser can read. Is there any danger in using them?
Fixed .htaccess file below.
AddType text/html;charset=utf-8 .html
RewriteEngine on
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
RewriteRule \.html$ - [T=application/xhtml+xml]
That is, firefox, mozilla and opera browsers to recognise the xhtml1.1 as application xml+xhtml and use the fallback IE as html tag soup. Stuff 'em :)
So, the original .htaccess file was sniffing for user agents. I really wanted to avoid this, but couldn't see any way around this. The file is below (well, te important parts anyway.
AddType text/html;charset=utf-8 .html
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} Opera [OR]
RewriteCond %{HTTP_USER_AGENT} Gecko [OR]
RewriteCond %{HTTP_USER_AGENT} Konqueror [OR]
RewriteCond %{HTTP_USER_AGENT} KHTML
RewriteRule \.html$ - [T=application/xhtml+xml]
So reading about the mess that user agents sniffers cause on the web, I learned about http_accept rules. They seem much better, and actually work on what the browser can read. Is there any danger in using them?
Fixed .htaccess file below.
AddType text/html;charset=utf-8 .html
RewriteEngine on
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
RewriteRule \.html$ - [T=application/xhtml+xml]