Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTACCESS Redirect all domain except two files

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).

This is my htaccess

RewriteEngine On
Rewritecond %{http_host} ^olddomain.org [NC]
Rewriterule ^(.*)$ http://newdomain.net/$1 [L,R=301]
like image 664
jose sanchez Avatar asked Sep 23 '13 16:09

jose sanchez


1 Answers

Use this rule:

RewriteEngine On
Rewritecond %{http_host} ^olddomain\.org [NC]
RewriteCond %{REQUEST_URI} !/(protectetfile1|protectetfile2)\.php [NC]
Rewriterule ^(.*)$ http://newdomain.net/$1 [L,R=301]
like image 86
anubhava Avatar answered Nov 06 '22 04:11

anubhava