无法使用.htaccess访问我的.css.php

时间:2014-06-14 19:46:33

标签: php apache .htaccess

我正在尝试访问我网站上的此链接 http://mydomain.com/lib/utils/utils.js.php http://mydomain.com/resources/script/myapp.home.js.php

我的.htaccess文件就像这样

<IfModule mod_rewrite.c>
  RewriteEngine on
RewriteRule ^resources/(.*).(css\.php|js\.php) ../build/resources/$1.$2 [L]
RewriteRule ^lib/(.*).(css\.php|js\.php) ../build/lib/$1.$2 [L]

RewriteRule ^lib/(.*).(css|js|txt|jpeg|jpg|png|gif|eot|svg|ttf|woff) ../lib/$1.$2 [L]
RewriteRule ^resources/(.*).(css|js|txt|jpeg|jpg|png|gif|eot|svg|ttf|woff) ../resources/$1.$2 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

我的文件夹结构是

app/handler/x.php
lib/utils/utils.js
build/resources/script/myapp.home.js.php
build/lib/utils/utils.js.php
resources/script/myapp.home.js
web/index.php
web/.htacsess

mydomain.com指向网络文件夹

但我可以访问此链接: - http://mydomain.com/index.php 但通过.htacess的所有其他文件,我得到的只是400个错误的请求

1 个答案:

答案 0 :(得分:0)

如果您使用的是apache,请尝试编辑文件&#34;默认&#34;在/ etc / apache2 / sites-available /和set

AllowOverride All

到位

AllowOverride None

重启apache(/etc/init.d/apache2 restart)