Redirect all website pages except two with htaccess rule

I would like to have a htaccess rule that redirects all website pages except two pages to a another url.

Example:

https://www.example.com/promo/checkout/cart/

and

https://www.example.com/promo/onestepcheckout/

all other pages with “promo” in them to be redirected to:

https://www.example.com

Thanks

What have you tried so far, @Freejoy?

I haven’t tried anything because I don’t know how.

This is a discussion forum, not a free coding service. I’m sure you are more likely to get some help if you do a bit of research, make an attempt at starting it and then asking for help when you get stuck.

I think it’s basically a case of adding a rewrite condition or two, saying not this page or that page, before the rewrite rule.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.