Home Blogs
Categories
Autos & vehicles Beauty & fashion Business & finance Climate Entertainment Food & drink Games Health Hobbies & leisure Jobs & education Law & government Other Pets & animals Politics Science Shopping Sports Technology Travel and transportation About Contact

sdfdsf

sdfdsf

sdfdsf

Common save locations

CodePhysical LocationPublic URL

public_path('sitemap.xml')

public/sitemap.xml

https://yourdomain.com/sitemap.xml

Storage::disk('public')->put('sitemap.xml')

storage/app/public/sitemap.xml

https://yourdomain.com/storage/sitemap.xml (after php artisan storage:link)

Storage::put('sitemap.xml')

storage/app/sitemap.xml

Not publicly accessible

Recommended for SEO

For search engines, I recommend saving directly to the public directory:







For multiple sitemaps:









These are immediately accessible:




If you're unsure

Show me your GenerateMainSitemapJob.php and GenerateNewsSitemapJob.php files, and I can tell you the exact location where your sitemaps are currently being saved.

what if i save all sitemaps in cloudfare

Yes, you can store your sitemaps in Cloudflare R2, but I would not recommend it for sitemaps.

Best Practice

Search engines expect your sitemap to be on the same domain as your website.

For example:



This is the ideal location.

Option 1 (Recommended): Save on Your Laravel Server







Pros:

  • Fast
  • No extra API calls
  • Google finds it immediately
  • Very simple

This is what most Laravel applications do.

Option 2: Save to Cloudflare R2

Laravel can upload directly:







Your sitemap becomes:



or



This works only if the bucket is publicly accessible.

SEO Consideration

Google prefers:



instead of



If your sitemap references URLs on https://yourdomain.com, hosting the sitemap on the same domain avoids any potential scope issues and is the conventional setup.

Best Enterprise Architecture

A common enterprise pattern is:










  • Primary copy on your web server (used by search engines)
  • Backup/archive in R2
  • If you have multiple servers, each deployment can regenerate the sitemap rather than sharing it through object storage.
Category
Technology
Tags
sd f d

0 Comments