问题
My .htaccess file is not working in IE, It works fine in FireFox and Chrome, but in IE images wont load, and links don't work correctly ether. The CSS works fine and all the PHP seams to be working aswell.
I am pretty sure that it has something to do with me needing to pull 2 GET variables from the url, because it works fine when I only need to pull one variable. Anyway here is my code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?([^/]+)/([^/]+)/?$ /website/index.php?id=$1&c=$2
Please help, I have been looking for hours for a solution for this.
回答1:
I don't see how ANY rewrite conditions would be browser dependent.. your problem must be somewhere else.
maybe try removing the leading / from your rule:
RewriteRule ^([^/]+)/([^/]+)/?$ /website/index.php?id=$1&c=$2
回答2:
Everything is working except for images and links, for example, lets say the base url is localhost/website/148/category and I click a link that should take me to localhost/website/149/category it takes me to localhost/website/148/category/149/category. So it is just adding onto the url it seams.
This is a relative/absolute URI issue, and not anything to do with your rewrite rules. Using the <base> tag is supposed to fix this but there's bugs in versions of IE8 which causes it to be ignored without a FQDN in front, something like:
<base href="http://localhost/website/">
(Not even really sure if that fixes the issue).
And yes, it needs to be before all other references and inside the <head> </head> tags. The only other recourse to fixing this is changing all your links to absolute URI's instead of relative ones.
来源:https://stackoverflow.com/questions/12443961/htaccess-not-working-properly-in-ie