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

编程入门 行业动态 更新时间:2024-10-27 00:22:32
本文介绍了如何通过查询字符串中的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重定向?

本文发布于:2023-10-31 19:20:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547035.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   重定向   错误   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!