的.htaccess不能正常工作在IE浏览器

编程入门 行业动态 更新时间:2024-10-25 14:31:14
本文介绍了的.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的问题,并没有任何与你的重写规则。使用<碱基GT; 标记应该解决这个问题,但有在这会导致它没有一个FQDN在前面被忽略,像IE8 版本的bug:

<基地HREF =HTTP://本地主机/网站/>

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

是的,它需要的所有其他引用前,&LT内部; HEAD> < /头> 标记。唯一的其他办法来解决这个正在改变所有的链接,以绝对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="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浏览器

本文发布于:2023-11-01 20:34:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550344.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不能正常   浏览器   工作   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!