Yes, the url to my-page/ is already being rewritten, it is a page in the WordPress system, as distinct from a post. I think I've worked out what I need to do.
If I retrieve the URL of the request $_SERVER['REQUEST_URI'] I can determine if URLs are being rewritten. Based on my testing so far:
- If the URL contains a ?page_id= then it is not being written and I can append my parameter onto the end and use the standard $_GET variable to get it. For example
- If the URL does not contain ?page_id then it is being rewritten and I can append my parameter onto the end of it in a different way and still get it via the $_GET variable. For example:
So far in my test both methods are working.
Many thanks for your help.