问题原文
原帖链接 · kratosserver2008 · CC BY-SA 4.0
I'm trying to submit my sitemap on my Google console but every time I add it, it keeps saying it couldn't fetch, I have uploaded my sitemap.xml into my domain root directory but still Google is not seeing it. Please, how can I solve this issue, have been on this for the past two days and it's like I'm going in circles.
My sitemap is in the public_html folder with name sitemap.xml.
UPDATE#1: This is my directory structure:
/home/winnerrs
/public_html
/app
/bootstrap
/config
/database
/docker
/public
/resources
/routes
/storage
.htaccess
artisan
composer.json
composer.lock
docker-compose.yml
Dockerfile
package.json
phpunit.xml
README.md
readme.md
robots.txt
server.php
sitemap.xml
webpack.mix.js
UPDATE#2: This my .htaccess file in the document root:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
已采纳解答
原帖链接 · MrWhite · CC BY-SA 4.0
Having looked at your directory structure, it would seem that many (all?) files in the document root (where you have uploaded sitemap.xml) are not accessible - they all return 404 Not Found when accessed publicly.
It looks like this might be a Laravel app and you are perhaps rewriting everything to the /public subdirectory (a typical usage pattern with Laravel). In which case you should move sitemap.xml (and any other files that should be publicly accessible) to the /public subdirectory.
To confirm this, we would need to see the contents of your root .htaccess file. (Please edit your question to include this.)
UPDATE: Your .htaccess file confirms the above.
RewriteRule ^$ public/ [L] RewriteRule (.*) public/$1 [L]
From your .htaccess file in the document root we can see that all requests are rewritten to the /public subdirectory. So, a request for example.com/sitemap.xml is internally rewritten to example.com/public/sitemap.xml.
This means your document root is "effectively" /home/winnerrs/public_html/public, not /home/winnerrs/public_html, as you first thought.
You need to move the sitemap.xml file from the public_html directory to the public_html/public directory.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
