Magento media url - get rid of 403 Forbidden

一个人想着一个人 提交于 2019-12-13 02:56:53

问题


on my Magento site (not the real url ;) ), I have http://magento.local.com/media/ returning as a 403 Forbidden.

This seems to be standard for all Magento installs, but I want to change this, and not have a 403 returned for requests to /media/.

How can I do this?

EDIT: (adding further information and reason for it)

I want /media/ to not be a 403, so that I can redirect requests to /media/ to /media/index.html.

I thought this redirect would be easy once the 403 was resolved, but unfortunately it is not. e.g.

RewriteRule ^$ /index.html [L,NC,R=301]

does not redirect /media/ at all, and the usual "Index of /" is displayed.

SOLUTION: add DirectoryIndex to the htaccess file

Thanks Paul


回答1:


Put .htaccess to your media/ dir with following contents:

Options All +Indexes
DirectoryIndex index.html



回答2:


Something to pay attention to.

The standard Magento .htaccess for the media directory is as follows:

Options All -Indexes
<IfModule mod_php5.c>
    php_flag engine 0
</IfModule>

# AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI

Due to the relaxed permissions Magento expects on this directory tree, they wish to prevent execution and interpretation of php and other scripts that could be maliciously uploaded into the directory tree and then executed remotely. As long as this function is preserved, you will be ok on modifications you make.



来源:https://stackoverflow.com/questions/11284767/magento-media-url-get-rid-of-403-forbidden

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!