Dear all,

I have a drupal7 installation which is accessible by 2 different domains :
www.mysite.com and/or www.othersite.com

both lead to the same content.

Trouble withe xmlsitemap :
I can access to the sitemap, using either www.mysite.com/sitemap.xml, either www.othersite.com/sitemap.xml
The problem is that these 2 sitemaps show the same links
www.mysite.com/node/1 (considering that "Default base URL" = www.mysite.com)

I would like that www.mysite.com/sitemap.xml show links such as
www.mysite.com/node/1
and www.othersite.com/sitemap.xml show links such as
www.othersite.com/node/1

According to what I understood (I may not understood correctly) of this module, that would need 2 modifications :
1/ no more parameter "Default base URL" (or different use of it)
2/ no cache, or different way of caching (based on $_SERVER[NAME] recognition)

Thanks for your feedbacks.

Comments

Anonymous’s picture

Title: use the $_SERVER[NAME] in case of multople domain name for the same site » use the $_SERVER[NAME] in case of multiple domain name for the same site
Status: Active » Postponed
Issue tags: +xmlsitemap 3.x

Although it might be possible to do the biggest reason to have a sitemap.xml is for SEO and having two sites with the exact same content defeats SEO. I'm marking this postponed because it would be too great a shift in current methodology. However, I could see the possibility of requiring the token module and outputting the chunk files with a token and before display apply the token substitution based on [server-name] or [base-url]. This could resolve some issues where users experience the incorrect name displayed.

shubhangibb’s picture

Hi All,

I am also facing same issue on my drupal setup. We have two domains one for desktop site and one for mobile site.
E.g www.example.com for desktop site and
www.m.example.com for mobile site.

We are also not getting the respective sitemap url's, because both domains share same code & database.
So we have used $GLOBALS['base_url'] in xmlsitemap.generate.inc file. instead of 'xmlsitemap_base_url' variable. In this we have changed in contributed xml sitemap module itself. So I want to submit this patch to drupal.org for user those are facing same issues.

So anyone could you please help me in this?

Thanks,
Shubhangi.

jaylotta’s picture

When I look at the xmlsitemap.generate.inc, I see this code..

  $url_options = $sitemap->uri['options'];
  $url_options += array(
    'absolute' => TRUE,
    'base_url' => variable_get('xmlsitemap_base_url', $GLOBALS['base_url']),
    'language' => language_default(),
    'alias' => variable_get('xmlsitemap_prefetch_aliases', TRUE),
  );

I'm not a drupal coding expert, but it looks like you will already use $GLOBALS['base_url'] is the module variable is not set. The only problem with this that I see is that the variable is a required field in the configuration screen. Wouldn't making the variable optional and leaving it blank solve the problem.

My case is when I move a test site to a live site, I need to touch the xmlsitemap configuration screen and change the base url for the sitemap to work. Since, our process involves moving the test site to a live site at the end of almost every day (the live site is for customers only, so they can see progress), this is cumbersome.

darrell_ulm’s picture

Issue summary: View changes

This is still and issue, I think, if you have 2 sites with different urls sharing the same code base (different databases/files-dir) and using the domain module.

I think this module still needs to be multi-domain aware when sites are sharing a codebase as a future option.

Scratch this, this may be an old thread.

This may work: https://www.drupal.org/project/domain_xmlsitemap

realrudymartin’s picture

You're right about not defining Default base URL in the setting file.

You are also not alone on wanting this to work across mulitple sites.

This in an old (several years) and recurring request that gets ignored on this project. It was an automatic feature in Drupal 5 for one of the early versions of a similar project. I once had over a dozen sites working with a server_name based site.xml file.

Unfortunately $_SERVER['SERVER_NAME'] and the alternative $_SERVER['HTTP_HOST'] can both be bugging depending on the server and configuration setups or user input. The alternative was to use the available $current_site global object which stores the domain variable ($current_site->domain).

Ideally this could be established in a settings file and then respected by other core and installed modules - good luck with that.

Maybe with Drupal 8 this is again a possibility.