Protocol is stripped by PHP
-
I have the following script in header.php with the intent of creating a hreflang tag:
<link rel="alternate" href="https://domain.com<?php echo parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH); ?>" hreflang="x-default" />
The idea is to return something like this:
<link rel="alternate" href="https://domain.com/URL/Path" hreflang="x-default" />
But what I get is:
<link rel="alternate" href="//domain.com/URL/Path" hreflang="x'-default" />
As you can see, the “https:” part has been left out but I need it for the hreflang tag. Any suggestions as to what’s happening?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Protocol is stripped by PHP’ is closed to new replies.