Newbie here: experiencing 404 errors with dynamic XML sitemap for Laravel SEO, any ideas?

Author
Oliver Wilson Author
|
6 hours ago Asked
|
2 Views
|
1 Replies
0

hello everyone! i'm a complete newbie to laravel and trying to get my first site indexed. i'm using the 'Dynamic XML Sitemap' solution for Laravel SEO, hoping to make things easy.

the problem is i keep getting a 404 not found error when i try to visit the sitemap URL (e.g., /sitemap.xml) in my browser. i've followed the installation steps really carefully, i think. i've installed the package, published the config, added the basic route like Route::get('/sitemap.xml', [SitemapController::class, 'index']); and even cleared the cache with php artisan cache:clear and config:clear. still no luck.

here's what i see in my browser / server logs:

GET /sitemap.xml HTTP/1.1
Host: myapp.test
User-Agent: Mozilla/5.0 ...
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=UTF-8

am i missing something super basic here? maybe a web server config for nginx or apache, or something in the Laravel routing i'm not understanding for Laravel SEO? any help would be super appreciated! anyone faced this before?

1 Answers

0
Zahra Khan
Answered 5 hours ago
am i missing something super basic here? maybe a web server config for nginx or apache, or something in the Laravel routing i'm not understanding for Laravel SEO?
The 404 for your dynamic XML sitemap often points to your web server configuration (Nginx or Apache) attempting to serve a physical file before Laravel's routing takes over. Ensure your server's `try_files` or `mod_rewrite` rules correctly direct all non-existent file requests to Laravel's `index.php` for effective SEO best practices. Hope this helps your conversions!

Your Answer

You must Log In to post an answer and earn reputation.