Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Magento:媒体文件未返回指定的输入文件_Php_.htaccess_Magento - Fatal编程技术网

Php Magento:媒体文件未返回指定的输入文件

Php Magento:媒体文件未返回指定的输入文件,php,.htaccess,magento,Php,.htaccess,Magento,我正在开发magento电子商务解决方案,目前遇到一个问题,无法从php访问/media目录中的文件。我在谷歌上搜索了很多,但还没有找到解决方案 /media目录中的My.htaccess文件如下所示: Options All -Indexes <IfModule mod_php5.c> php_flag engine 0 </IfModule> # AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml

我正在开发magento电子商务解决方案,目前遇到一个问题,无法从php访问/media目录中的文件。我在谷歌上搜索了很多,但还没有找到解决方案

/media目录中的My.htaccess文件如下所示:

    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

<IfModule mod_rewrite.c>

############################################
## enable rewrites
    RewriteEngine on

############################################
## never rewrite for existing files
    RewriteCond %{REQUEST_FILENAME} !-f

############################################
## rewrite everything else to index.php
    RewriteRule .* ../get.php [L]
</IfModule>
选项所有-索引
php_标志引擎0
#AddHandler cgi script.php.pl.py.jsp.asp.htm.shtml.sh.cgi
#选项-执行CGI
############################################
##启用重写
重新启动发动机
############################################
##决不重写现有文件
重写cond%{REQUEST_FILENAME}-F
############################################
##将所有其他内容重写为index.php
重写规则。*../get.php[L]

我不是Apache重写方面的专家。然而,我相信你的重写条件是不完整的。以下是我在大多数Magento网站上使用的:

<IfModule mod_rewrite.c>

############################################
## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

############################################
## rewrite API2 calls to api.php (by now it is REST only)

    RewriteRule ^api/rest api.php?type=rest [QSA,L]

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>

问题的原因是:Options-ExecCGI和Options-All-index它现在可以工作了。谢谢你的意见!我忽略了带有选项All-Indexes的行,这是我在您发布文章后立即意识到的。谢谢
find . -type f -exec chmod 644 {} ;
find . -type d -exec chmod 755 {} ;
chmod o+w var var/.htaccess app/etc
chmod 550 pear
chmod -R o+w media