http2-server-push
http2-server-push copied to clipboard
Use root URL to check against resource URL
Hi,
Using site_url
to get the "root" URL is always wrong. site_url
is the path to WordPress. Indeed, most of the time (regular WP structure) home_url
== site_url
. But it can sometimes be different. In my case (using Bedrock or any WordPress-in-a-subdirectory structure type), site_url
is https://domain.com/wp
. This kind of setup is pretty popular among developers.
As pointed out in #19, multi language plugins such Polylang or WPML change the value of home_url
. That's why this PR parses home URL to extract the root domain only.
Maybe the comparison should be more accurate. An edge case like https://externaldomain.com/domain.com.css
would match the check. But yes, it is far-fetched and very unlikely to happen 😄