简体   繁体   English

如何在htaccess中将Microsoft Edge与Chrome分开?

[英]How to separate Microsoft Edge from Chrome in htaccess?

I have this in my .htaccess file: 我在.htaccess文件中有这个:

RewriteEngine on

RewriteCond %{HTTP_USER_AGENT} Chrome
RewriteRule ^(.*)$ page.php [NC,L]

Microsoft Edge browser thinks it is Chrome and goes to page.php. Microsoft Edge浏览器认为它是Chrome并转到page.php。 Is there any way to avoid Edge from using the Chrome command, so it would not go to page.php? 有没有办法避免Edge使用Chrome命令,所以它不会去page.php?

I have googled so much and I haven't found anything how to direct Edge browser. 我搜索了这么多,我还没有找到任何如何指导Edge浏览器。 Any help? 有帮助吗? Thanks!! 谢谢!!

The Edge user agent has the word Edge in it, eg Edge用户代理在其中包含Edge,例如

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12. Mozilla / 5.0(Windows NT 10.0; Win64; x64)AppleWebKit / 537.36(KHTML,与Gecko一样)Chrome / 42.0.2311.135 Safari / 537.36 Edge / 12。

It also has the word Chrome in it, so place a rewrite rule for Edge before the one for Chrome. 它中还包含Chrome一词,因此在Chrome之前放置一条重写规则。

Note that this was done intentionally (thanks to @Axalix for the link) 请注意,这是故意完成的 (感谢@Axalix的链接)

Many websites that you visit today will not display well in IE because they are not coded properly and usually display a page like they would in an old browser, even though Internet Explorer 11 supports many of the new web standards. 您今天访问的许多网站都不能很好地在IE中显示,因为它们编码不正确,并且通常显示像在旧浏览器中一样的页面,即使Internet Explorer 11支持许多新的Web标准。 Some pages will display incorrectly in IE while working perfectly fine on other browsers such as Chrome or Firefox. 某些页面在IE中显示不正确,而在其他浏览器(如Chrome或Firefox)上完美运行时。

So you may not want to treat Edge any differently than you do Chrome. 因此,您可能不希望Edge的处理方式与Chrome相同。 Certainly don't just assume it's like a new version of IE. 当然不要只是假设它像IE的新版本。

Is there any way to avoid Edge from using the Chrome command, so it would not go to page.php? 有没有办法避免Edge使用Chrome命令,所以它不会去page.php?

It's not a command, but a user agent header that the browser sends. 它不是命令,而是浏览器发送的用户代理标头。 No, you cannot prevent Edge browsers from sending the user agent that they do. 不,您无法阻止Edge浏览器发送他们执行的用户代理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM