htaccess的&放大器; PHP - 允许//在GET数据
如果您打算为-1这个问题,告诉我,我该怎么改进它,而不是只是离开它。
这是几个编辑一DUP 的
我在做一个开放源码的软件,但我的.htaccess需要一些调整。
I'm making an open-source piece of software, but my .htaccess needs a little tuning.
我如何让一个URL,例如 www.mydomain.net/forum/method/user//abc
并保持 //
在我的PHP code抓住它的时候?
How do I allow a URL such as www.mydomain.net/forum/method/user//abc
and keep the //
when grabbing it in my PHP code?
我在这里看:允许斜杠URL的.htaccess
但是,这并没有帮助。
下面是我有:
的.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?/=$1 [NC,QSA,L,NE]
和
geturl.php
$url = (isset($_GET['/']) ? $_GET['/'] : null);
die($url);
输出:帐户/注册/ 2 / sskssks
网址:帐户/注册/ 2 // sskssks
期望的输出:帐户/注册/ 2 // sskssks
基本上,事情是消除/修剪//并把它置/.
Basically, something is removing/trimming the // and setting it to /.
第3节的RFC 3986 涵盖了通用语法的路径组件的在统一资源标识符(URI)。
Section 3 of RFC 3986 covers the generic syntax of path components in a Uniform Resource Identifier (URI).
path = path-abempty ; begins with "/" or is empty
/ path-absolute ; begins with "/" but not "//"
/ path-noscheme ; begins with a non-colon segment
/ path-rootless ; begins with a segment
/ path-empty ; zero characters
path-abempty = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-noscheme = segment-nz-nc *( "/" segment )
path-rootless = segment-nz *( "/" segment )
path-empty = 0<pchar>
segment = *pchar
segment-nz = 1*pchar
segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
; non-zero-length segment without any colon ":"
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
该行定义段NZ
表示,在路径各个段,即 / AAA / BBB / CCC
(AAA,BBB和CCC'各自链段),不能为空。他们必须包含至少一(1)为PChar
。有用于开始绝对路径是根和空( /
),只是空的特殊情况下,一对夫妇别人讨论的Web网址时很少遇到的。
The line defining segment-nz
indicates that individual segments in a path, i.e. /aaa/bbb/ccc
('aaa', 'bbb', and 'ccc' are each segments), cannot be empty. They must contain at least one(1) pchar
. There are special cases for beginning an absolute path that is rooted and empty (/
) and simply empty, and a couple others that are rarely encountered when discussing Web URLs.
您URI路径正在的归的,剥离多余的 /
从您的路径。如果斜杠是非常重要的,你需要将它的数据的使用的%的编码。
Your URI path is being normalized, stripping the extra /
from your path. If that slash is important, you will need to send it as data by using percent encoding.