的.htaccess prevent B标志从编码+符号或更改%20事件再度发生到+? [英] .htaccess prevent B flag from encoding + symbols or change occurences of %20 into +?

查看:124
本文介绍了的.htaccess prevent B标志从编码+符号或更改%20事件再度发生到+?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这行我的.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.

这篇关于的.htaccess prevent B标志从编码+符号或更改%20事件再度发生到+?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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