Php 如何使整个';请求URI';转到一个参数
我使用ApacheRewrite_mod在.htaccess文件中使用以下命令将URL地址进入参数文本后进行所有测试Php 如何使整个';请求URI';转到一个参数,php,apache,mod-rewrite,parameters,Php,Apache,Mod Rewrite,Parameters,我使用ApacheRewrite_mod在.htaccess文件中使用以下命令将URL地址进入参数文本后进行所有测试 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?text=$1 [L,QSA] 如果我有www.example.com/some_text 但是当我有www.example.com/some_text/some other t
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?text=$1 [L,QSA]
如果我有www.example.com/some_text
但是当我有www.example.com/some_text/some other text
我想在text参数中包含整个请求:“some_text/some other text”
不仅仅是“其他文本”
可以这样做吗?我正在使用它,它可以完美地工作:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$0 [PT,L]
我会让apache/php解决这个问题:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
PHP将您可能需要的所有信息存储在$\u服务器中
$_SERVER['REQUEST_URI'] // Original uri with original query string
$_SERVER['REDIRECT_QUERY_STRING'] // Original query string
$_SERVER['REDIRECT_URL'] // Original uri without query string
此方法将保留$\u GET/$\u POST/$\u请求等。
$\u服务器['QUERY\u STRING']
将包含查询字符串。好的一点,它们是相同的。(虽然我认为重定向版本包含原始版本,但它没有。)