PHP: parse URL for matching directory /somedirectory/ and execute conditional code

Posted by Scott B on Stack Overflow See other posts from Stack Overflow or by Scott B
Published on 2009-11-20T19:49:39Z Indexed on 2010/05/16 22:20 UTC
Read the original article Hit count: 165

Filed under:
|
|

This has to be pretty simple, but I'd like to parse the current URL and execute conditional code depending on whether the user is on the /sitemap/ directory.

So for example, if the site is example.com, and if the request is example.com/sitemap/.

Then I want to execute conditional code in that case. I'm using wordpress so I'm not sure if there is a built-in function that gets this...

A pure PHP solution is fine.

© Stack Overflow or respective owner

Related posts about php

Related posts about url