using regex to redirect to a new page ONLY when a specific domain is used
-
I have a site with more than one possible domain in use.
There is a main brand url, and then several sub-brand urls – but they all arrive at the homepage when users visit them.
I’d like to be able to setup a rule that uses regex to detect which domain is in use and then if it is any of the sub-brands redirect the users to an alternate homepage.
So… user visits https://www.main-brand.com and remains at the configured homepage
if the user visits https://www.sub-brand-1.com the regex recognises this and redirects the user to https://www.main-brand.com/sub-brand-1and the same for as many sub-brand rules as I wish to configure.
I had started by just using “^https://www.sub-brand-1.com” as my query, but this doesnt work. I need to match it not start with it, and dont know how to do this!!!
Also, it is worthwhile to consider that there are lots of landing pages created for the site and so this rule should only work is the exact url is entered. If, for example, the user visits https://www.sub-brand-1.com/content-page then they should remain on this page without any redirection.
Thanks in advance for your help on this.
- The topic ‘using regex to redirect to a new page ONLY when a specific domain is used’ is closed to new replies.