Laravel 应用程序中的站点地图
Sitemap in Laravel application
我想用 Laravel 框架为我的网站制作站点地图。 Laravel 应用程序中的默认 .htaccess 文件如下所示:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
据我所知,这个 .htacces 将每个请求重定向到 index.php。现在,如果 sitemap.xml 文件位于根目录中,而 robots.txt 中是站点地图的路径怎么办?搜索引擎机器人应该发出 'www.example.com/sitemap.xml' 之类的请求来查找和读取站点地图文件,对吗?但是当 .htaccess 将每个请求重定向到 index.php?
时,机器人如何找到这个文件
别担心。请求重定向到 index.php
如果:
这不是现有目录:
RewriteCond %{REQUEST_FILENAME} !-d
这不是一个现有文件:
RewriteCond %{REQUEST_FILENAME} !-f
我想用 Laravel 框架为我的网站制作站点地图。 Laravel 应用程序中的默认 .htaccess 文件如下所示:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
据我所知,这个 .htacces 将每个请求重定向到 index.php。现在,如果 sitemap.xml 文件位于根目录中,而 robots.txt 中是站点地图的路径怎么办?搜索引擎机器人应该发出 'www.example.com/sitemap.xml' 之类的请求来查找和读取站点地图文件,对吗?但是当 .htaccess 将每个请求重定向到 index.php?
时,机器人如何找到这个文件别担心。请求重定向到 index.php
如果:
这不是现有目录:
RewriteCond %{REQUEST_FILENAME} !-d
这不是一个现有文件:
RewriteCond %{REQUEST_FILENAME} !-f