mod_rewrite规则:如果URL包含某个字符串

发布于 2024-08-23 15:33:56 字数 390 浏览 2 评论 0原文

我的客户不断编辑网站中的导航结构,这导致了一些 mod_rewrite 问题。我如何制定此规则:

RewriteRule ^studios/about-studios/artist-noticeboard noticeboard2.php?section=studios&subSection=studio-artists [L]

如果网址包含“noticeboard”,则该规则有效?像这样:

RewriteRule ^IF CONTAINS 'noticeboard' noticeboard2.php?section=studios&subSection=studio-artists [L]

欢迎任何指点!

My client keeps editing the structure of the navigation in the website, which is leading to some mod_rewrite issues. How could i make this rule:

RewriteRule ^studios/about-studios/artist-noticeboard noticeboard2.php?section=studios&subSection=studio-artists [L]

to work if the url contains "noticeboard"? Like this:

RewriteRule ^IF CONTAINS 'noticeboard' noticeboard2.php?section=studios&subSection=studio-artists [L]

Any pointers welcome!

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

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

发布评论

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

评论(1

冷月断魂刀 2024-08-30 15:33:56

尝试一下:

RewriteCond %{REQUEST_URI} !/noticeboard2\.php$
RewriteRule noticeboard noticeboard2.php?section=studios&subSection=studio-artists [L]

此规则会将 URL 路径中包含“noticeboard”的所有请求重写为同一目录中的 noticeboard2.php

Try this:

RewriteCond %{REQUEST_URI} !/noticeboard2\.php$
RewriteRule noticeboard noticeboard2.php?section=studios&subSection=studio-artists [L]

This rule will rewrite any request that contains “noticeboard” in the URL path to noticeboard2.php in the same directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文