In the code for the hook url alter options we can't override base url. I think we need to add an extra condition to check if we are overriding the base url in the hook.

For example with a multisite with multiple domains. I created a context per domain and then I need to say a domain per context but I can't override because always use the same. I attach a patch for fix this problem.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fastangel created an issue. See original summary.

pifagor’s picture

You have to enable patch testing

pifagor’s picture

This patch didn't passed the tests. you need to work on the patch

pawel_r’s picture

I had problem after moving from test to production server: base_url was always as test it was on test server. There is no good solution (at the moment) besides changing state value: \Drupal::state()->set('xmlsitemap_base_url','PRODUCTION BASE URL');

Waiting for proper patch.

SocialNicheGuru’s picture

Can I set xmlsitemap_base_url variable via the local settings form like this $settings['xmlsitemap_base_url']?

Arrow’s picture

@SocialNicheGuru You can with the patch in #2999856: Allow Override of Base URL in settings.php

vuil’s picture

Thank you, @Arrow. Yes, you are right. I added the mentioned issue as "related".

alex_optim’s picture

pifagor’s picture

Status: Needs review » Fixed

Yes @alex_optim right

pifagor’s picture

Status: Fixed » Closed (fixed)