How to do link rewrites conditionally
Hi All,
I am looking for a solution to rewrite outgoing URLs of certain pages conditionally. Content setup is
/content
/common
/contactus.html
/privarypolicy.html
/careers
/ukpositions.html
/indiapositions.html
/research
/article1.html
/article2.html
/Products
/product1.html
/product2.html
/Services
/service1.html
/service2.html
1. Product and Services section have their own themes
2. Products and Services pages will have links to pages under /common, /careers and /research which are common pages.
3. If user navigates to a common page then page should inherit theme from the source section /Products or /Services. Any further navigation to another common page should also use the same theme.
Some challenges
1. Using HTTP_REFERRER would not work beyond 1st navigation
2. It has to be a Non JS solution
My thought is to do URL rewrites based on content path i.e. if a link to a common page is rendered on a page underneath /Products then i append a selector .products and similarly if if a link to a common page is rendered on a page underneath /Services then i append a selector .services. Then i can have selector scripts for common page templates and include respective design css.
However what i am not clear is what is a clean solution to do this URL rewrite without having to modify individual components that render these links.
Thanks