如果 URL 包含某个字符串,则 htaccess 重定向 [英] htaccess redirect if URL contains a certain string

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

问题描述

如果 URL 包含某个单词,我将如何编写 .htaccess 重定向规则?

How would I write a .htaccess redirect rule if the URL contains a certain word?

例如如果它包含 foobar 然后重定向到 index.php

e.g. if it contains foobar then redirect to index.php

推荐答案

RewriteCond %{REQUEST_URI} foobar
RewriteRule .* index.php

某些变体.

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

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