Correctly match against Site & Community URLs

In sandbox, these URLs have format
https://sandboxname-domain.csXX.force.com/communityPrefix/