Thanks for making the new thread!
I was digging into this yesterday after your original comment on the other post, playing around with my own setup to reproduce the issue and I could reproduce something (though I was using a virtual host, but basically changed it to a port other than 80 so that it’d show up in the URL).
I believe your $_SERVER['SERVER_NAME']
variable is set to www.argenteriadabbene.com
so the previous combination of putting
$_SERVER['SERVER_NAME']
+ :
+ $_SERVER['SERVER_PORT']
+ $_SERVER['REQUEST_URI']
would’ve made
www.argenteriadabbene.com
+ :
+ 443
+ /it/prodotto/ricci-ascot/
Which, without the plus signs, would’ve appropriately outputted www.argenteriadabbene.com:433/it/prodotto/ricci-ascot/
as the URL previously. As we know, that code worked for you.
With the updated code in 3.3.0 being this:
// Build the full URL
if (!empty($_SERVER['SERVER_PORT']) && intval($_SERVER['SERVER_PORT']) !== 80) {
$url = network_home_url() . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
} else {
$url = network_home_url($_SERVER['REQUEST_URI']);
}
And since $_SERVER['SERVER_PORT']
has a value of 443
, that first if-statement is evaluating to true, with this line:
network_home_url()
+ :
+ $_SERVER['SERVER_PORT']
+ $_SERVER['REQUEST_URI']
becoming this:
argenteriadabbene.com/it
+ :
+ 443
+ /it/prodotto/ricci-ascot/
That makes me believe network_home_url()
identifies your domain inclusive of the language directory (and without the configured www
in your server name variable).
In my local environment, I ended up with something like:
local.aurisecreative.com:443
+ :
+ 443
+ /some-random-page/
Since network_home_url()
was also inclusive of the port. I resolved the issue that showed up in my local environment with this snippet:
// Build the full URL
if (!empty($_SERVER['SERVER_PORT']) && intval($_SERVER['SERVER_PORT']) !== 80 && (strpos($host = network_home_url(), $port = ':' . $_SERVER['SERVER_PORT']) === false)) {
$url = $host . $port . $_SERVER['REQUEST_URI'];
} else {
$url = network_home_url($_SERVER['REQUEST_URI']);
}
But without having qtranslate-xt in my environment, it didn’t recreate your issue exactly, the doubling of the /it
path. I’m not totally convinced this snippet would fix your problem since it’s not the port number being doubled, but the /it
path.
I’ll get the plugin in my local environment to play with it more to see if I can really reproduce your issue. I am curious to see how this plugin works!