So I have a situation on a site where I need multiple permalink structures. Now, I already know what you're going to say because literally every Google and SX result I've looked through says the same thing: Don't do this; this is a bad idea; here be dragons; etc. I've already heard all that. I've already sorted out link canonicalization and the og:url and SEO isn't an issue.
The reality is, though, the client wants a variation of the existing site in a "subdirectory" that is the same page structure, but has some PHP logic within template files. So, it's the same content, but the page looks a little different according to business rules for the subset of users that will be accessing via this different URL.
So with that understanding, what is the best way to define in Wordpress that:
http://www.example.com/abc/ should be rewritten to http://www.example.com/
http://www.example.com/abc/about/ should be rewritten to http://www.example.com/about/
and so on?
I currently have rules defined manually using add_rewrite_rule()
:
add_rewrite_rule('abc/?$','index.php?page_id=6','top');
add_rewrite_rule('abc/about/?$','index.php?page_id=9','top');
But that's unmaintainable. I'd like a way for it to act like those add_rewrite_rule()
calls, but apply to the whole site, ideally without having to go through and look up every URL individually from the database.
Rewrites only, redirects are not acceptable.
Thoughts?