Question

I'm struggling with an weird issue. I can't make any custom files / folders in my root of magento. I want to make a custom folder with some images, resulating in 404 errors when trying to reach the path of this images.

Also, the generated XML Sitemap throws an 404 error. The path for the sitemap is /sitemaps/sitemap.xml. Magento can't find this path. Is there a seting i'm overlooking? Because first it worked well.

Hope someone can help me with this!

Was it helpful?

Solution

Okay it's solved by putting the folders in the /pub/ directory :-)

OTHER TIPS

-> I solved this problem same issue I getting my store.

Please follow below step.

-> 1. Please make a custom folder in your root. (ex:- sitemap and yes please give full permission to this folder (chmod -R 777 sitemap))

-> 2. log in your admin panel and following this path.(Marketing->SEO & Search -> Sitemap).

-> 3. add a new sitemap. please see below image.

enter image description here

-> After all step perform you need to save and generate sitemap your problem solved.

-> it's working for me please follow this step.

Step 1: First you create any custom folder in your root directory (example : Here is my custom folder name = "sitemap").

(Note: (ex:- sitemap and yes please give full permission to this folder (chmod -R 777 sitemap))

Step 2: Magento Admin-->(Marketing->SEO & Search -> Sitemap).

Step 3: add a new sitemap. please see below image.

enter image description here

Step 4: Now check your url somthing like ...http://192.168.1.226/magento1/sitemap/sitemap.xml

This seems to be fixed in Magento ver. 2.2.1 which is wired as your version of store is higher. Have a look at this: https://github.com/magento/magento2/pull/9094

I see you found the solution by moving the sitemap to the pub directory, however, this is not a great solution if you want to generate the sitemap automatically (same applies to robots.txt).

Applying the above fix should fix the core issue. Alternatively, you can create a Nginx/Apache rule the will create the alias for the file. Example NginX rule:

# robots
location = /robots.txt {
    alias /full/path/example.com/http/robots.txt;
}

# sitemap
location = /sitemap.xml {
    alias /full/path/example.com/http/sitemap.xml;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top