Add sitemap and robots.txt
When creating and adding your sitemap and robots.txt to your store, you may run into issues due to the read-only environment. You may receive errors such as the following:
The path ".:///app/app/" is not writable. Path "/app/pub/static/sitemap.xml" is protected and cannot be used.
To best add these files, please review the steps below.
For Magento Commerce (Cloud) 2.2, you do not need to move the files or have a redirection added. If you used these workarounds before 2.2, you can return the files to the original locations and ticket to have the redirection removed.
Generate sitemap and robots
Access an environment fully configured for your site:
- For Starter, access an active branch for example
- For Pro, access your
masterenvironment in Integration
- Log into the Magento Admin.
- Navigate to Marketing > Site Map.
- Click Add Sitemap to generate a new site map. The file saves as
- Navigate to Stores > Configuration > Design.
- Select options and update
- Save your configuration.
Import files to environment
If you accessed the environment directoy, you need to transfer the files from the environment to your local. For example, you can use
scd through a terminal. If you completed the commands on your local, move the files to the correct location. The following example uses
Move and add the files to your Git branch:
- SSH into the environment you created the files.
rsyncto move the files to your local. The format of the command is
rsync -azvP <source> <destination>.
- SSH into the environment you want to move the files into.
Move the files into the
/pub/media/directory using the rsync command:
rsync -azvP pub/media/
- Enter a ticket with Support to have URL rewrite rules added for
When the redirects are completed, keep these files updated in that file location for your Git branches during deployment.