如何通过查询字符串中的404错误通过的.htaccess重定向? [英] how to Pass query string in 404 error redirect through .htaccess?

查看:168
本文介绍了如何通过查询字符串中的404错误通过的.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 queryaboutusing$_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屋!

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