Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 仅更改js和css文件的IE in.htaccess的URL_Php_Apache_.htaccess_Mod Rewrite_Url Rewriting - Fatal编程技术网

Php 仅更改js和css文件的IE in.htaccess的URL

Php 仅更改js和css文件的IE in.htaccess的URL,php,apache,.htaccess,mod-rewrite,url-rewriting,Php,Apache,.htaccess,Mod Rewrite,Url Rewriting,考虑一下我使用IE获得的这个URL(仅适用于.js和.css文件): 我需要的是从中删除“it/categories/”部分,以便找到该文件。虽然对于其他浏览器,会形成正确的URL: 以下是我的.htaccess文件中的内容: RewriteEngine On RewriteBase / RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] RewriteRule ^googlebase.xml$ index.p

考虑一下我使用IE获得的这个URL(仅适用于.js和.css文件):

我需要的是从中删除“it/categories/”部分,以便找到该文件。虽然对于其他浏览器,会形成正确的URL:

以下是我的.htaccess文件中的内容:

RewriteEngine On

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
RedirectMatch "^/it/([a-zA-Z0-9]+)(/(.*))?$" "http://example.com/$3"
我尝试在.htaccess结尾添加以下行:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !.*\.(js|css)
RewriteCond %{HTTP_USER_AGENT} MSIE
RewriteRule ^it/categories/(.+) /$1 [L]
但它不起作用。我错过了什么? 我在这里发现了一个类似的问题:

虽然正如我提到的,在我的例子中,坏的URL只使用IE浏览器形成

编辑

发现这可能是由于IE无法解压缩g-zipped文件(Apache)。关于这个问题:

根据这一点,我尝试删除以前的更改并在.htaccess文件中添加此行:

RewriteEngine On

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
RedirectMatch "^/it/([a-zA-Z0-9]+)(/(.*))?$" "http://example.com/$3"
没有结果。你知道为什么吗

编辑2

毕竟,我发现这也不是一个g-zip问题(因为只要切换页面显示语言,页面就可以在IE中正常工作)。这意味着真正的问题在于断开的链接(arkascha是正确的,再次感谢!)

由于我还没有真正了解php,我通过在.htaccess文件中添加这一行来实现这一点:

RewriteEngine On

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
RedirectMatch "^/it/([a-zA-Z0-9]+)(/(.*))?$" "http://example.com/$3"

虽然我知道这并不能解决问题,但在我的情况下,至少我让它起作用了

这个问题根本没有意义;这些链接首先来自哪里?你怎么可能在IE中得到不同的结果?这是不正常的…停止尝试修复症状,修复原因insead,断开的链接。感谢Claies和arkascha的建议。我现在更新了问题。希望你能再次帮助我!首先,您是否在apache中启用了mod_setenvif?其次,您可能需要在
浏览器匹配\bMSIE中使用
MSIE
而不是
\bMSIE
!没有gzip!仅限gzip文本/html