0

我在一个 Magento 安装上设置了多商店,所有商店都在不同的服务器上。我为它们中的每一个创建了符号链接。现在我想为每个商店生成 sitemap.xml。我在我的根目录上创建了一个名为 sitemaps 的文件夹,在我为每个商店创建的站点地图内。(即站点地图内的store1、store2)。现在,我在每个商店的文件夹中生成 sitemap.xml。我还在 store1.com 的 .htaccess 中添加了以下行:

RewriteRule ^sitemap.xml$ http://www.mainserver.com/sitemaps/store1/sitemap.xml [NC]

(在此处找到此帮助:http: //www.magentocommerce.com/boards/viewthread/59388/)现在,如果我输入 www.store1.com/sitemap.xml,我应该能够看到该商店的 xml,但我'我得到 404 Not Found 错误。有任何想法吗?

4

1 回答 1

0

从Magento 堆栈复制

注意:我试过这种方式它总是有效的。

首先,在您网站的根目录中创建一个名为 sitemaps 的新文件夹,然后为每个域创建子文件夹。

/sitemaps/domain_1/
/sitemaps/domain_2/

然后登录到 Magento 管理员并导航到 - catatlog -> google 站点地图

为每个商店创建或编辑站点地图列表,并将“站点地图路径”字段设置为您为商店创建的路径。

/sitemaps/domain_1/
/sitemaps/domain_2/

更新您的 robots.txt 文件。确保搜索引擎蜘蛛正确定向到新站点地图。您可能需要更新或创建 robots.txt 文件。编辑 robots.txt 文件并在顶部添加以下行 —</p>

# Website Sitemap
Sitemap: http://www.domain_1.com/sitemaps/domain_1/sitemap.xml  
Sitemap: http://www.domain_2.com/sitemaps/domain_2/sitemap.xml

最后,如果您的网站使用 Apache Web 服务器引擎,您应该更新网站根目录中的.htaccess文件,以将任何其他站点地图请求定向到正确的位置。在读取的行下方找到以下行 - RewriteEngine on

并在其下方添加以下重定向语句 -</p>

# Sitemap: http://www.domain_1.com/sitemaps/domain_1/sitemap.xml
RewriteCond %{HTTP_HOST} ^.*domain_1\.com$
RewriteRule ^sitemap.xml$ sitemaps/domain_1/sitemap.xml [NC,L,R=301]

# Sitemap: http://www.domain_2.com/sitemaps/domain_2/sitemap.xml
RewriteCond %{HTTP_HOST} ^.*domain_2\.com$
RewriteRule ^sitemap.xml$ sitemaps/domain_2/sitemap.xml [NC,L,R=301]
于 2018-08-10T11:55:46.490 回答