如何重定向到的index.php所有请求,并保留其他GET PARAMS?

编程入门 行业动态 更新时间:2024-10-24 16:27:23
本文介绍了如何重定向到的index.php所有请求,并保留其他GET PARAMS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

下面就是我这么远:

RewriteEngine叙述上的RewriteCond%{} REQUEST_FILENAME!index.php文件重写规则。*的index.php?URL = $ 0 L]

但是,当我去soemthing像 / A?B = C ,然后检查GET参数,可以我只得到 A 为网​​址和 b 丢失。我如何可以保留?

解决方案

RewriteEngine叙述上的RewriteCond%{} REQUEST_FILENAME!index.php文件重写规则。*的index.php?URL = $ 0 QSA,L]

您需要QSA在你重写规则。

Here's what I've got so far:

RewriteEngine on RewriteCond %{REQUEST_FILENAME} !index.php RewriteRule .* index.php?url=$0 [L]

But when I go to soemthing like /a?b=c and then inspect the GET params, I only get a for url, and b is lost. How can I retain that?

解决方案

RewriteEngine on RewriteCond %{REQUEST_FILENAME} !index.php RewriteRule .* index.php?url=$0 [QSA,L]

You need the QSA in your rewrite rule.

更多推荐

如何重定向到的index.php所有请求,并保留其他GET PARAMS?

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

发布评论

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

>www.elefans.com

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