繁体   English   中英

如何通过.htaccess传递404错误重定向中的查询字符串?

[英]how to Pass query string in 404 error redirect through .htaccess?

我有一个index.php文件,该文件处理对服务器的所有请求。 我已经通过以下方式在.htaccess中设置了404错误重定向:

ErrorDocument 404 /index.php

如果用户请求文件,例如page.php ,那么它将被正确地重定向到index.php页面。

当用户请求page.php?page=about, then my index.php is unable to retrieve the query时出现问题page.php?page=about, then my index.php is unable to retrieve the query using $ _REQUEST ['page']` page.php?page=about, then my index.php is unable to retrieve the query

我怎样才能查询about通过使用index.php文件$_REQUEST['page']

$_SERVER['REDIRECT_QUERY_STRING']可能包含您的查询字符串。

试一下。

<?php
    print_r($_SERVER['REDIRECT_QUERY_STRING']);
?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM