Robots.txt and sitemap.xml doesn't show (Lightning)

Hello,

I am testing Local Lightning on Linux and found problem.
robots.txt, sitemap.xml and sitemap_index.xml doesn’t show with any SEO plugin.
If you insert url for example: http://domain.local/sitemap.xml it show 404 nginx error. But if you insert for example: http://domain.local/sitemap.xml/ it works. Also http://domain.local/sitemap.xmlanything works. There is problem with nginx WordPress rules. I think this affects all files straight after domain.local.

I added this code:

if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}

in …/conf/nginx/includes/wordpress-multi.conf.hbs (for multisite or wordpress-single.conf.hbs for single site) and it works now. But http://domain.local/sitemap.xmlanything stil works and it is not ok.

Thank you.

2 Likes

Confirming that this works. Thank you @shimsa

1 Like

@RyanEMitchell,

Awesome, thanks for confirming this!


@shimsa,

Thanks for the original post and solution. I’ve added this to our JIRA backlog to look into.

1 Like

You’re welcome and thank you for fix it.

But code above is not completely correct, because for example http://domain.local/sitemap.xmlanything show also content of the sitemap.xml.

Got it! We’ll dig in :smiley:

1 Like

I tried this but always get 404 when going to http://domain.local/sitemap_index.xml

The main sitemap still accessible via http://domain.local/?sitemap=1 but all the links are getting 404.

Then I added what YOAST recommended rewrite rule

location ~ ([^/]*)sitemap(.*).x(m|s)l$ {
  ## this rewrites sitemap.xml to /sitemap_index.xml
  rewrite ^/sitemap.xml$ /sitemap_index.xml permanent;
  ## this makes the XML sitemaps work
  rewrite ^/([a-z]+)?-?sitemap.xsl$ /index.php?yoast-sitemap-xsl=$1 last;
  rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
  rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
  ## The following lines are optional for the premium extensions
  ## News SEO
  rewrite ^/news-sitemap.xml$ /index.php?sitemap=wpseo_news last;
  ## Local SEO
  rewrite ^/locations.kml$ /index.php?sitemap=wpseo_local_kml last;
  rewrite ^/geo-sitemap.xml$ /index.php?sitemap=wpseo_local last;
  ## Video SEO
  rewrite ^/video-sitemap.xsl$ /index.php?yoast-sitemap-xsl=video last;
}

in the same config file but still not working.

Hope anyone can help. Thanks!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

For anyone watching this topic, a fix was released with the 5.9.6 version of Local.

Updating to the latest version of Local should get things working, but if you still run into issues, can you let us know?