Skip to content

PHP: Check if current URL is part of defined URL

I want to check of the current URL is part of a pre-defined URL. For example: I want to check if the domain example.com/shop/ is part of the viewed URL. I’m using the following function to get the current URL and a pre-defined ($shop_page_url) URL: In this case it only works if the $shop_page_url is the…