I’m working on an multi-national site for which the sponsors want pages supported so that each page:

  • Can be served from a single default page regardless of the country (80% of pages), and
  • Default pages can be ‘overridden’ by optionally including a country specific page. (NOT redirected.)

In-country people will maintain the country-custom 20% of pages, and a central person will maintain the other 80%.

I’m thinking of doing the following:

  • Have a generic page which is automatically used if the country specific page does not exist: site.com/default/slug-name/

  • Use the country specific page instead if it does exist. (i.e. New Zealand: site.com/nz/slug-name/)

So going to the follow pages ...

  • site.com/us/slug-name/ => returns content of: /default/slug-name/
  • site.com/nz/slug-name/ => returns content of: /nz/slug-name/
  • site.com/br/slug-name/ => returns content of: /default/slug-name/
  • … etc …

And going to: site.com/slug-name/ will cause an IP location Lookup and will use the best guess of the country then will return the content for the appropriate country page.

So 2 questions:

1) Where (what WP hook) should I use to get the incoming request url and set/update the actual page reference whose content I want to return?

  1. Get the incoming URL, check for matching slug.
  2. If has exact match slug, then process that page. (continue default processing).
  3. If no country matching slug exists, then update the "page to process" to the /default/slug-name page.

2) Are there any Plug-ins that have done this for me already?

Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.