mod_rewrite - 固定和可变查询字符串参数

发布于 2024-09-04 12:42:27 字数 210 浏览 3 评论 0原文

我想将

www.mydomain.com/approve/SomeFunkyVariable 发送到

www.mydomain.com/home/index.php?option=com_content&task=view&id=574&Itemid=85&approve=someFunkyVariable

的规则是什么这?

I want to send

www.mydomain.com/approve/SomeFunkyVariable to

www.mydomain.com/home/index.php?option=com_content&task=view&id=574&Itemid=85&approve=someFunkyVariable

What is the rule for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽你眉间 2024-09-11 12:42:27

完全忽略参数(考虑到您没有提到它们)

RewriteEngine on
RewriteRule ^approve/([^/\.]+)/?$ index.php?option=com_content&task=view&id=574&Itemid=85&approve=$1 [L]

要包含参数,您需要一个像

www.mydomain.com/com_content/view/547/85/approve/SomeFunkyVariable这样的网址

RewriteEngine on
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)?$ index.php?option=$1&task=$2&id=$3&Itemid=$4&$5=$6 [L]

Completely ignoring the params (considering you haven't mentioned them)

RewriteEngine on
RewriteRule ^approve/([^/\.]+)/?$ index.php?option=com_content&task=view&id=574&Itemid=85&approve=$1 [L]

To include the params you'll need a url like

www.mydomain.com/com_content/view/547/85/approve/SomeFunkyVariable

RewriteEngine on
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)?$ index.php?option=$1&task=$2&id=$3&Itemid=$4&$5=$6 [L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文