gpt4 book ai didi

regex - HTACCESS 重定向除两个文件之外的所有域

转载 作者:行者123 更新时间:2023-12-04 10:07:52 24 4
gpt4 key购买 nike

我的实际 htaccess 将我完整的旧站点重定向到我的新站点,我想重定向所有域,但除了两个文件 .php(protectetfile1.php 和 protectedfile2.php)。

这是我的 htaccess

RewriteEngine On
Rewritecond %{http_host} ^olddomain.org [NC]
Rewriterule ^(.*)$ http://newdomain.net/$1 [L,R=301]

最佳答案

使用这个规则:

RewriteEngine On
Rewritecond %{http_host} ^olddomain\.org [NC]
RewriteCond %{REQUEST_URI} !/(protectetfile1|protectetfile2)\.php [NC]
Rewriterule ^(.*)$ http://newdomain.net/$1 [L,R=301]

关于regex - HTACCESS 重定向除两个文件之外的所有域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18964045/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com