php - using .htaccess redirect specific URL -


how redirect website :

www.old.com/test.php -> www.new.com/test.php 

but enter other links www.new.com/

www.new.com/test1.php -> www.old.com/test1.php www.new.com/test2.php -> www.old.com/test2.php www.new.com/test3.php -> www.old.com/test3.php 

how if file names not in sequence, this:

www.new.com/home.php -> www.old.com/aiej.php www.new.com/contactus.php -> www.old.com/contact.php www.new.com/aboutus.php -> www.old.com/aboutus.php www.new.com/msdv.php -> www.old.com/msdv.php 

only test.php redirect www.new.com/, others redirect www.old.com

i prefer use .htaccess file. suggestion?

try rules in .htaccess

rewriteengine on rewritebase /  # redirect test.php new rewritecond %{http_host} ^www\.old\.com$ [nc] rewriterule ^(test)\.php$ http://www.new.com/$1.php [r=301,l]  # redirect test* old rewritecond %{http_host} ^www\.new\.com$ [nc] rewriterule ^test(.+)\.php$ http://www.old.com/test$1.php [r=301,l] 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -