• Resolved twogee

    (@twogee)


    For a website served with two DNS names corresponding to the same IP address (say, foo.com and foo.info), I would expect sitemap to be generated using the DNS name configured in site URL (https://foo.com, in this case).

    However, since upgrade to the latest version of the SEO Framework (3.0.3), the sitemap is generated with the alternate name in the URLs. Unless I missed something, I would like to have an option to “pin” the sitemap to site URL. The website is using Hydra plugin, if that is relevant.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hi @twogee,

    This is a long comment, addressing both SEO and security concerns.

    In any case, I’d first like to point out that the sitemap is cached through transient caching. That’s why, with the combination of WP Hydra, it might get stuck at one URL instead of the other until the cache is refreshed. You can disable this cache through “General SEO Settings”, under the “Performance” tab.

    SEO concerns:
    What you’re dealing with is duplicated content. The SEO Framework does everything to prevent that, including pointing only to “one” URL.

    You might also note that the canonical URLs always point to what you’ve set in the “Site Address (URL)” field in the General WordPress Settings.

    In the 3.0 update, I’ve restructured the URL layout to even further adhere to the WordPress API; so, it now listens more closely to the aforementioned setting.

    If you’d wish to ignore the duplicated content warnings, then I believe you can effectively change this behavior using the home_url filter:
    https://developer.wordpress.org/reference/hooks/home_url/

    Security concerns:
    Note that dynamically setting the home_url based on the request will open your website to security complications. As anyone can hijack your website through rogue DNS. Unless you set predefined “accepted” hosts/domains that will fall back to one if it doesn’t match, I can’t recommend doing so. Looking at the code, WP Hydra doesn’t allow you to setup accepted domains, so I advise not to use it.

    Plugin Author Sybre Waaijer

    (@cybr)

    For closure, I want to leave you a suggestion using this .htaccess entry:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
    RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

    Explained:

    RewriteEngine on # Turn on the Rewrite engine if it wasn't already.
    RewriteCond %{HTTP_HOST} !^example\.com$ [NC] # If the host isn't example.com, execute the following line.
    RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] # Redirect (301) the visitor to example.com, including the entered directory and query.
    

    That’ll allow you to have both addresses pointed towards your server, but only one is the true domain. This will solve both the aforementioned security and duplicated content issues.

    Happy holidays! 🙂

    Thread Starter twogee

    (@twogee)

    Thank you for prompt reply. I will raise issues with hosting provider and WP Hydra.

    Happy holidays! 🎅

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Incorrect URL in sitemap.xml’ is closed to new replies.