我真的面临一个奇怪的问题,那就是我不能从media
文件夹访问任何文件,而我可以从js
文件夹访问文件,这是在相同的位置,如:
app/public/media
app/public/js
媒体文件夹权限设置为777
,我在项目中没有任何。htaccess文件。
虚拟主机配置如下
<Directory "/home/ashwani/public_html/www/myproject">
Options -Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
#Require all granted
Order deny,allow
Allow from all
</Directory>
<VirtualHost *:80>
ServerAdmin webmaster@gamer.localhost
DocumentRoot "/home/ashwani/public_html/www/myproject/public"
ServerName local.myproject.com
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/css/(.*)$ /css/$1 [QSA,L]
RewriteRule ^/js/(.*)$ /js/$1 [QSA,L]
RewriteRule ^/img/(.*)$ /img/$1 [QSA,L]
RewriteRule ^/fonts/(.*)$ /fonts/$1 [QSA,L]
RewriteRule ^/media/(.*)$ /media/$1 [QSA,L]
RewriteRule ^/(.*).html$ /$1.html [QSA,L]
RewriteRule ^/(.*).css$ /$1.css [QSA,L]
RewriteRule ^/(.*?)$ /index.php?_myproject=$1 [QSA,L]
</IfModule>
</VirtualHost>
我不明白这是怎么回事
试试这个:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.*?)$ /index.php?_myproject=$1 [QSA,L]
</IfModule>
我不确定这是否会起作用,因为这只是对你无休止的规则列表的简化,我只是想为真实的文件提供服务。