的.htaccess不能正常工作在IE浏览器 [英] .htaccess Not Working Properly In IE

查看:113
本文介绍了的.htaccess不能正常工作在IE浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.htaccess文件不工作在IE,它工作在Firefox和Chrome罚款,但在IE浏览器的图像不会加载,并且链接不正常工作醚。 CSS的正常工作和所有的PHP接缝是藏汉工作。

我是pretty确保它是与我需要去拉2 GET变量从URL,因为它工作正常时,我只需要拉一个变量。反正这是我的code

  RewriteEngine叙述在
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^ /?([^ /] +)/([^ /] +)/ $ /website/index.php?id=$1&c=$2

请帮帮忙,我一直在寻找小时,一个解决方案。


解决方案

  

一切工作,除了图像和链接,例如,可以说基本URL为localhost /网站/ 148 /类别和我单击要带我一个链接到本地​​主机/网站/ 149 /类需要我为localhost /网站/ 148 /分类/ 149 /类别。所以它只是添加到它接缝的URL。


这是一个相对/绝对URI的问题,并没有任何与你的重写规则。使用&LT;碱基GT; 标记应该解决这个问题,但有<一个href=\"http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/c51bb8b9-40ab-437b-a125-88b660f3e1ca/\"相对=nofollow>在这会导致它没有一个FQDN在前面被忽略,像IE8 版本的bug:

 &LT;基地HREF =HTTP://本地主机/网站/&GT;

(甚至不是真的知道是否能解决这个问题)。

是的,它需要的所有其他引用前,&LT内部; HEAD&GT; &LT; /头&GT; 标记。唯一的其他办法来解决这个正在改变所有的链接,以绝对URI的,而不是相对的。

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.

解决方案

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.

这篇关于的.htaccess不能正常工作在IE浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆