Hello folks I'm trying to do a permanent redirect on a website to a new domain via .htaccess, but I need there to be exceptions to that redirect. For example, some posts and pages will remain there so should not be redirected. I've tried writing conditions a few different ways, but no luck in getting an URL exception to work. Any ideas? Redirecting page by page just isn't an option. Thanks in advance for any help!
Any particular reason you want to use .htaccess and not from an existing include like a config file (dirty but effective)?
@sarahk No reason at all - I'm happy to take whatever route is effective and institutes a clear 301 for SEO purposes. I'm not sure I follow on the idea of a config file executing redirects though?
The config file is just one that every page calls and is a useful place to put the check - dirty but effective. Config files get called before anything is output to the browser so header() commands can still be called. Check to see if the requested url is one of the ones you are keeping and continue or else do the header() command and exit.