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 development branch
- 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.
Add files to Git
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.
Move and add the files to your Git branch:
- Move the files into the
/pub/media/directory. This is a writable directory for .
Add the files to Git. For example:
git add pub/media/sitemap.xml && git commit -m “Add sitemap” && git push origin master
git add pub/media/robots.txt && git commit -m “Add robots” && git push origin master
- Push and merge your changes in development, Staging, and Production environments.
- Enter a ticket with Support to have redirects added for
When the redirects are completed, keep these files updated in that file location for your Git branches during deployment.