1

I use this below code for redirect old site to new . all thing work but I want one page (php) not direct to new site . I test all way in this site and google but no way work !

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !new.com$ [NC]
RewriteRule ^(.*)$ http://new.com/$1 [L,R=301] 

RewriteEngine On  

RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f  

RewriteRule ^(.*)$ index.php?param=$1
RewriteCond %{HTTP_HOST} ^www\.old\.com [NC]

this topic and other not work for me :( . I want only jrequest.php in root folder not redirect to new site . sorry for my poor english

Community
  • 1
  • 1
bnnoor
  • 656
  • 2
  • 13
  • 31

1 Answers1

1

To exclude the file, put the following condition above your rule :

RewriteCond %{REQUEST_FILENAME} !filename\.php$ 

Your htacess :

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !new.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !filename\.php$ 
RewriteRule ^(.*)$ http://new.com/$1 [L,R=301] 
 RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f  

RewriteRule ^(.*)$ index.php?param=$1 [L]
Amit Verma
  • 40,709
  • 21
  • 93
  • 115