HTACCESS url 重写

发布于 2024-09-30 12:19:20 字数 580 浏览 1 评论 0原文

我正在尝试重写这个网址,但它似乎不起作用,我不清楚出了什么问题

我想要这个网址:

www.mysite.com/dvd-123/Studio/studio_name.php?thumbs=yes&order=price

实际发送到:

www.mysite/cat/list_products.php?studio=123&store=dvd&thumbs=yes&order=price

这是我所拥有的正在工作的内容:

RewriteRule ^dvd-([0-9]+)/Studio/(.*)\.php?(.*)$ cat/list_products.php?studio=$1&store=dvd&$3 [L]

我收到的结果就像我想要的一样: www.mysite/cat/list_products.php?studio=123&store=dvd 忽略: &thumbs=yes$order=price

预先感谢您的帮助!

I am trying to rewrite this url and it just doesn't seem to be working and I am unclear what is going wrong

I want this URL:

www.mysite.com/dvd-123/Studio/studio_name.php?thumbs=yes&order=price

To actually send to:

www.mysite/cat/list_products.php?studio=123&store=dvd&thumbs=yes&order=price

Here is what I have that is sorta working:

RewriteRule ^dvd-([0-9]+)/Studio/(.*)\.php?(.*)$ cat/list_products.php?studio=$1&store=dvd&$3 [L]

The results I am receiving are the same as if i want to:
www.mysite/cat/list_products.php?studio=123&store=dvd
ignoring the:
&thumbs=yes$order=price

Thank you in advance for your help!

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

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

发布评论

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

评论(2

坦然微笑 2024-10-07 12:19:20

来自 Apache 文档

模式不会与查询字符串匹配。 .. 要将新查询字符串与旧查询字符串合并,请使用 [QSA] 标志。

我还没有对此进行测试,但希望它能为您指明正确的方向。

RewriteRule ^dvd-([0-9]+)/Studio/(.*)\.php$ cat/user_list_products.php?Manname=$1&store=dvd [L,QSA]

From Apache documentation:

The Pattern will not be matched against the query string... To combine a new query string with an old one, use the [QSA] flag.

I haven't tested this, but hopefully it should point you in the right direction.

RewriteRule ^dvd-([0-9]+)/Studio/(.*)\.php$ cat/user_list_products.php?Manname=$1&store=dvd [L,QSA]
情绪少女 2024-10-07 12:19:20

你需要逃避斜杠。

RewriteRule ^dvd-([0-9]+)\/Studio\/(.*)\.php?(.*)$ cat/user_list_products.php?Manname=$1&store=dvd&supersale=$3 [L]

You need to escape the slashes.

RewriteRule ^dvd-([0-9]+)\/Studio\/(.*)\.php?(.*)$ cat/user_list_products.php?Manname=$1&store=dvd&supersale=$3 [L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文