Tomas Turan
Tomas Turan

Reputation: 1255

Sitemap in Laravel application

I would like to make a sitemap for my website that is made in Laravel framework. Default .htaccess file in Laravel application looks like this:

<IfModule mod_rewrite.c>

<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

</IfModule>

As far as I know, this .htacces is redirecting every request to index.php. Now what if sitemap.xml file is in root directory and in robots.txt is path to the sitemap? Search engine bot should make request like 'www.example.com/sitemap.xml' to find and read sitemap file, right? But how can bots find this file, when .htaccess is redirecting every request to index.php?

Upvotes: 1

Views: 553

Answers (1)

Marek
Marek

Reputation: 7433

Don't worry. Request is redirected to index.php if:

  • It's not an existing directory:

    RewriteCond %{REQUEST_FILENAME} !-d

  • It's not an existing file:

    RewriteCond %{REQUEST_FILENAME} !-f

Upvotes: 1

Related Questions