gpt4 book ai didi

string - 在 .htaccess 中重写查询字符串

转载 作者:行者123 更新时间:2023-12-01 01:32:58 25 4
gpt4 key购买 nike

我正在尝试对查询字符串进行非常简单的重写,但我一点运气都没有。我需要从

http:// example dot com/?ACT=jquery



http:// example dot com/index.php?ACT=jquery

这是我在 .htaccess 文件中编写的代码,它向我抛出一个内部服务器错误。我对整个 mod 重写业务真的很陌生,所以任何帮助都将不胜感激。

RewriteEngine On

RewriteCond %{query_string} ^(ACT=jquery)$

RewriteRule ^(.*)$ index.php/?ACT=jquery

最佳答案

如果您只是希望它在不通知浏览器的情况下获取 php 文件:

RewriteEngine On
RewriteRule ^/\?ACT=jquery$ index.php/?ACT=jquery [PT,L]

如果您希望浏览器更改书签等以创建一个 cononical URL:
RewriteEngine On
RewriteRule ^/\?ACT=jquery$ index.php/?ACT=jquery [R=301,L]

假设任意参数:
RewriteEngine On
RewriteRule ^/\?(.*)$ index.php/?$1 [PT,L]

或者您可能更喜欢脚本别名:
ScriptAliasMatch ^(.*)\?(.*)$ index.php

关于string - 在 .htaccess 中重写查询字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3614473/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com