URL中的分号通过.htaccess更改为%3b [英] Semi-colons in URL changes to %3b via .htaccess

查看:263
本文介绍了URL中的分号通过.htaccess更改为%3b的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的.htaccess文件-

This is my .htaccess file -

RewriteCond %{REQUEST_URI} !(/$|\.) 
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] 

<IfModule mod_rewrite.c>
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^template\.php$ - [L]
#RewriteRule ^index\.php$ - [L]
RewriteRule . /template.php [L]
</IfModule>

它旨在通过/template.php汇集所有内容,因此它会处理其余的URL&域。

It's designed to funnel everything through /template.php so it processes the rest of the URL & domains.

无论出于何种原因,当URL中提供分号(这是构建房地产网站上的列表查询的URL的重要组成部分)时,分号都会改变到%3b,这不是我想要的。

For whatever reason, when there's semi-colons provided in the URL (which is an important piece of the URL constructing the listing queries on my real estate websites) the semicolons change to %3b which is NOT what I want.

奇怪的是,这仅发生在一个网站上...我所有的网站都在同一台服务器上。

Oddly enough this is happening on one website only... all of my sites are on the same server.

http://dev.brixwork.com/listings/city-Vancouver+West/area-Arbutus;Cambie;Coal+Harbour/order_by-create_date/order_direction- DESC / page-1

在测试网址上方可以使用。

THe above test URL is fine.

但是在这里保存相同的文件。

However take that same file here..

http://suzannec.brixwork.com/listings / city-Vancouver + West / area-Arbutus; Cambie; Coal + Harbour / order_by-create_date / order_direction-DESC / page-1

我会注意到子区域名称(Arbutus,Cambie& Coal Harbour)之间的地址神秘地更改为%3b,并且生成的页面标题也错误,因为它没有传递正确的数组进行处理。

And you'll notice that the ; between the subarea names (Arbutus, Cambie & Coal Harbour) mysteriously changes to %3b, and the page title generated is wrong as well, because it's not getting the proper array passed for processing.

我完全意识到这可能不是.htaccess问题...但这是我能想到的最好的方法。

I'm fully aware that this may NOT be an .htaccess issue... but that's the best I could think up.

推荐答案

您的第一个规则就是这样做。当我单击您的第二个链接时,由于它没有以斜杠或句号结尾,因此它会将我重定向到相同的URI(除了斜杠之外)。尝试使用 NE 标志,以便不对分号进行编码:

Your first rule is doing this. When I click on your second link, since it doesn't end with a slash or a period, it redirects me to the same URI except with a slash. Try using the NE flag so that the semicolons don't get encoded:

RewriteCond %{REQUEST_URI} !(/$|\.) 
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L,NE] 

不确定为什么 dev 网站没有做同样的事情,除非它缺少重定向规则。

Not sure why the dev site isn't doing the same thing, unless it's missing the redirect rule.

这篇关于URL中的分号通过.htaccess更改为%3b的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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