的.htaccess prevent B标志从编码+符号或更改%20事件再度发生到+?符号、标志、发生、事件

2023-09-02 01:08:29 作者:DC释放 _c7忧郁

这行我的.htaccess文件的基本逃脱并打开第一个目录到一个查询字符串。

This line of my .htaccess file basically escapes and turns the first directory into a query string.

RewriteRule ^([^/]+)/?$ /a/?s=$1 [L,QSA,B]

我这样做主要是为了逃避和放大器;符号,但它避开了所有的非字母数字字符,包括+符号。我不想逃避这些的,这样的网址都比较干净。

I did this mainly to escape & symbols, but it escapes all non alphanumeric characters, including '+' symbols. I don't want to escape these ones so that urls are more clean.

eat%20a%20pizza

我想:

eat+a+pizza

是否有可能以某种方式来替换%20与+或prevent B标志的编码呢?

Is it possible to somehow replace '%20' with '+' or prevent the B flag from encoding then?

推荐答案

不知道是否有一种方法是具体的关于如何使用 B 标志的作品,但你可以改变在 20%返回 + 这一点:

Not sure if there's a way to be specific about how the B flag works, but you can change the %20 back to + with this:

RewriteRule ^(.*)%20(.*)$ /$1+$2 [NE,L]

您很可能会需要找到合适的地方放了,因为它需要循环,以摆脱所有的 20%的的。

You're probably going to need to find the right place to put that, as it needs to loop in order to get rid of all the %20's.

 
精彩推荐
图片推荐