7

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]
anubhava
  • 761,203
  • 64
  • 569
  • 643
jose sanchez
  • 339
  • 4
  • 12

1 Answers1

15

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]
anubhava
  • 761,203
  • 64
  • 569
  • 643