regex - 重定向除一个请求之外的所有请求

标签 regex apache mod-rewrite

我想知道如何重定向所有请求,例如

foobar.com/cat
foobar.com/cat/1
foobar.com/etc

foobar.com/index.php

但不影响

foobar.com/webmaster/

我不希望 foobar.com/webmaster/重定向到index.php。我想要它的默认行为

如何使用 mod_rewrite 做到这一点?

最佳答案

RewriteEngine on

RewriteRule ^webmaster/ - [QSA,L]
RewriteRule .* index.php [QSA,L]

关于regex - 重定向除一个请求之外的所有请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5959752/

相关文章:

performance - apache bench 中连接、处理、等待的定义

apache - mod_rewrite 不适用于查询字符串重定向

php - Apache 日志行太长

linux - 重写 httpd.conf 中的规则 (Apache)

apache - 基于http状态码的rewritecond

.htaccess - 如何合并两个 .htaccess 重定向?

r - 查找并用星号替换单元格,*

此正则表达式模式的 C# 等效项

c posix 正则表达式验证输入 HH :MM:SS time string

regex - Bash 中字母重复的单词