如何通过查询字符串中的404错误通过的.htaccess重定向? [英] how to Pass query string in 404 error redirect through .htaccess?
问题描述
我有一个的index.php
负责处理所有的请求到服务器上的文件。我给自己定了一个404错误重定向的.htaccess
以这种方式:
I have an index.php
file which handles all requests to the server. I've set up a 404 error redirect in .htaccess
in this way:
ErrorDocument 404 /index.php
如果一个用户请求一个文件,比方说, page.php
,那么它就会被重定向到的index.php
正确的页面。
If a users request a file, say, page.php
, then it gets redirected to the index.php
page properly.
当用户请求的问题就出现了 page.php?页=约,那么我的index.php无法
关于使用检索查询
$ _ REQUEST ['页']'。
The problem arises when the users request page.php?page=about, then my index.php is unable to retrieve the query
aboutusing
$_REQUEST['page']`.
我怎样才能查询关于
通过使用的index.php $ _ REQUEST ['页']
?
How can i get the query about
through the index.php using $_REQUEST['page']
?
推荐答案
$ _ SERVER ['REDIRECT_QUERY_STRING']
可能包含您的查询字符串。
$_SERVER['REDIRECT_QUERY_STRING']
may contain your query strings.
给这个一杆。
<?php
print_r($_SERVER['REDIRECT_QUERY_STRING']);
?>
这篇关于如何通过查询字符串中的404错误通过的.htaccess重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!