HTACCESS重定向除两个文件以外的所有域 [英] HTACCESS Redirect all domain except two files
本文介绍了HTACCESS重定向除两个文件以外的所有域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的实际htaccess将我的完整旧站点重定向到我的新站点,我想将所有域重定向,但将两个文件.php(protectetfile1.php和protectedfile2.php)除外.
My actual htaccess redirect my complete old site to my new site, I want to redirect all domain but except two file .php (protectetfile1.php and protectedfile2.php).
这是我的htaccess
This is my 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]
这篇关于HTACCESS重定向除两个文件以外的所有域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文