mod_rewrite的规则:如果URL中包含某些字符串 [英] mod_rewrite rule: if URL contains a certain string

查看:120
本文介绍了mod_rewrite的规则:如果URL中包含某些字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户保持编辑导航的网站,这是导致一些mod_rewrite的问题的结构。我怎么能做出这样的规则:

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]

工作,如果URL中包含布告栏?像这样的:

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

任何指针欢迎!

Any pointers welcome!

推荐答案

试试这个:

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

此规则将改写包含在URL路径布告栏来的 noticeboard2.php 的任何请求在同一目录下。

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

这篇关于mod_rewrite的规则:如果URL中包含某些字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆