HTACCESS重定向除两个文件以外的所有域

jos*_*hez 7 regex .htaccess mod-rewrite

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

这是我的htaccess

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

anu*_*ava 15

使用此规则:

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