【问题标题】:RedirectMatch RegEx — Need to have an exceptionRedirectMatch RegEx - 需要有一个例外
【发布时间】:2014-08-27 10:37:57
【问题描述】:

我有这个 RedirectMatch 指令:

RedirectMatch 404 (.old|.csv|.txt|.sql|.ini)$

我现在想排除 robots.txt,但继续为所有其他 .txt 发送 404。怎么样?

我看着 RedirectMatch 403 -- Need to have an exception for 1 URL in .htaccess 摆弄它,但我无法让它工作。

你能帮忙吗?

【问题讨论】:

    标签: regex apache mod-alias


    【解决方案1】:

    你可以使用消极的后视

    RedirectMatch 404 (.old|.csv|(?<!robots).txt|.sql|.ini)$
    

    【讨论】:

    • 谢谢你提到“消极后视”这个词,我会查一下
    猜你喜欢
    • 1970-01-01
    • 2011-03-29
    • 2015-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-10
    • 1970-01-01
    • 2022-01-18
    相关资源
    最近更新 更多