How to use WP Rewrite to override reserved URL base types
-
Context:
I have 2 sets of authors that I wish to display on my site:
1. WordPress users that i have listed on an author “archive” page (/authors/) with each author linking to their profile page at /authors/[author-name]
2. An off-site database of users
Problem:
I can’t combine these two sets of users within one single URL structure.
Question:
Is there a way to have group #2 share the /authors/ URL structure? In other words, is there a way to utilize WP Rewrite so that requests to /authors/10-digit-number will be handled differently than /authors/fname-lname?
In this scenario, external authors all have a numeric ID, which i would like to pass via “pretty” url structure. The end goal is to have a mostly seamless section of authors instead of having to resort to creating two different URL structures: /mysite/authors/ and /external/authors/
I have tried using a combination of rewrite rules (im using IIS7) in web.config, as well as via PHP plugin code. Despite my efforts, if the sub-folder does not refer to an existing wordpress user, I get a 404 response header. I would like to somehow inform wordpress to make the following distinction:
URL: /authors/(.*)
Process all requests to this URL by calling author.php template.
Then inside my author.php template, id have rules to grab the ID from the REQUEST URI and get the user info, even if they aren’t a wordpress user.
I know this is one helluva specific issue, but ive been tearing my hair out. Is this even possible?
Cheers
- The topic ‘How to use WP Rewrite to override reserved URL base types’ is closed to new replies.