Redirect all pages of a domain except for one page with .htaccess

I had a really tough time this morning trying to figure out how to redirect all pages of one domain to another domain, but stop one (or two) of the pages on the old domain from redirecting.

The solution is as follows:

 
RewriteEngine on
#Note: do not include a "/" in the beginning of the path, this is automatic
RewriteCond $1 !^enquiry_control/enquiry4.php
RewriteCond $1 !^enquiry_control/capt.php
RewriteRule (.*) http://talooma.com/$1 [R=301,L]

Yup, its as easy as that – typical.

Author: NickDuncan

Nick is the owner of Code Cabin, founder of WP Google Maps, WP Live Chat Support, and Sola Plugins,

4 thoughts on “Redirect all pages of a domain except for one page with .htaccess”

  1. Hello thanks for sharing this, very appreciated. But when I try this the pages which not redirect to new domain it not happen and redirect to 404page of new domain with .shtml extension. BTW I’m working with wordpress.
     

Leave a Reply

Your email address will not be published. Required fields are marked *