.htaccess - 如果 URL 包含某个字符串,则 htaccess 重定向

标签 .htaccess

我该怎么写 .htaccess如果 URL 包含某个单词,则重定向规则?

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

最佳答案

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

some variant thereof .

关于.htaccess - 如果 URL 包含某个字符串,则 htaccess 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3220377/

相关文章:

php - 在 PHP 中获取 .htaccess RewriteBase 参数的值

.htaccess - RewriteEngine 所有重写都必须开启?

python - 使用 fastcgi 在共享主机上设置的 Pyramid 将 .fcgi 文件返回给浏览器

php - 如何使用htaccess限制对文件夹及其子文件夹中所有文件的访问并重定向到主文件夹?

.htaccess - 临时重定向到维护页面

php - .htaccess mod_rewrite 错误

apache - htaccess 中的 301 重定向具有参数 P 的 URL

apache - X-Robots-Tag 未显示在 HTTP 响应 header 中

.htaccess - RewriteCond %{REQUEST_FILENAME} !-d 不工作

regex - .htaccess 重定向和可见 URL