[wp-trac] [WordPress Trac] #43311: Missing full path to Sitemap in virtual robots.txt

WordPress Trac noreply at wordpress.org
Wed Feb 14 09:02:45 UTC 2018


#43311: Missing full path to Sitemap in virtual robots.txt
--------------------------+-------------------------
 Reporter:  kohlermedia   |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:
 Severity:  normal        |  Resolution:  worksforme
 Keywords:                |     Focuses:
--------------------------+-------------------------
Changes (by ocean90):

 * status:  new => closed
 * focuses:  coding-standards =>
 * version:  4.9.4 =>
 * milestone:  Awaiting Review =>
 * resolution:   => worksforme


Old description:

> The function witch generates the virtual robots.txt strips the path
> https://mydomain.com/sitemap.xml to /sitemap.xml.
>
> Tested with
> add_filter( 'robots_txt', 'robots_mod', 10, 2 );
> function robots_mod( $output, $public ) {
>         $output .= "Sitemap: https://mydomain.com/sitemap.xml/\n";
>         return $output;
> }
> in functions.php
>
> sitemaps.org notes
> "You can specify the location of the Sitemap using a robots.txt file. To
> do this, simply add the following line '''including the full URL to the
> sitemap''': Sitemap: http://www.example.com/sitemap.xml"
>
> Google search console marks a sitemap without full path as error.

New description:

 The function witch generates the virtual robots.txt strips the path
 https://mydomain.com/sitemap.xml to /sitemap.xml.

 Tested with
 {{{#!php
 <?php
 add_filter( 'robots_txt', 'robots_mod', 10, 2 );
 function robots_mod( $output, $public ) {
         $output .= "Sitemap: https://mydomain.com/sitemap.xml/\n";
         return $output;
 }
 }}}

 in functions.php

 sitemaps.org notes
 "You can specify the location of the Sitemap using a robots.txt file. To
 do this, simply add the following line '''including the full URL to the
 sitemap''': Sitemap: http://www.example.com/sitemap.xml"

 Google search console marks a sitemap without full path as error.

--

Comment:

 Hello @kohlermedia, welcome to WordPress Trac!

 Thanks for your report. I couldn't reproduce the issue on a clean install.
 In core we have no function that would replace the domain there.

 Try disabling all plugins and maybe activate a default theme to find the
 cause for this. For additional help, please try our
 [https://wordpress.org/support/ Support Forums].

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43311#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list