Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>After A LOT of hit and miss (probably since I don't know .htaccess) I've figured it out:</p> <pre><code>RewriteEngine on RewriteCond %{HTTP_USER_AGENT} .*MSIE.* RedirectMatch ^/$ index.IE.htm DirectoryIndex index.xhtml </code></pre> <p>The above snippet will have effect when someone visits "http://www.yoursite.com/optionalFolder/". It will redirect from there, to index.IE.htm if the visitor is any form of Internet Explorer over version 4, else (if you're not IE) go to index.xhtml.</p> <hr> <p>I have also found a neat trick to get Internet Explorer to actually read the same .xhtml as Text/HTML, so you won't have to maintain 2 separate versions of the same site:</p> <pre><code>RewriteEngine on RewriteCond %{HTTP_USER_AGENT} .*MSIE.* RewriteCond %{REQUEST_URI} \.xhtml$ RewriteRule .* - [T=text/html] </code></pre> <p>This snippet has effect when someone accesses "http://www.yoursite.com/<strong>anyPageName.xhtml</strong>". If it's Internet Explorer, then it will overwrite the document type to <strong>text/html</strong> instead of <strong>application/xhtml+xml</strong>. Else, any other browser will open the xhtml normally.</p> <hr> <p><strong>Question:</strong> How can I get snippet #2 to work for a URL that has just the directory path? </p> <p>(it only works for "http://www.yoursite.com/<strong>pageName.xhtml</strong>"; how can I get it to work for "http://www.yoursite.com/optionalFolder/"?)</p> <p>In other words, <code>DirectoryIndex index.xhtml</code> doesn't work in snippet #2 (it overpowers the RewriteRule for IE; if I add DirectoryIndex, IE will auto-download the xhml)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload