2011-05-02 68 views
0

我在我的Web服务器中有一个.htaccess文件,它从我的URL中删除index.php。 当我想要访问位于我的web服务器子目录中的.php文件时,就会出现问题。为什么.htaccess阻止访问.php文件

我htacess文件是这样的:

# Turn on URL rewriting 

RewriteEngine On 

# Installation directory 

RewriteBase/


# Protect application and system files from being viewed 

RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L] 


# Allow any files or directories that exist to be displayed directly 

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteCond %{REQUEST_FILENAME} !-d 

# Rewrite all other URLs to index.php/URL 

RewriteRule .* index.php/$0 [PT] 

现在,如果我想访问一个PHP文件是这样的:

http://www.mydomain.com/subfolder/assets/17041f49/tiny_mce/tiny_mce_gzip.php

服务器返回500错误。

我应该怎么做才能解决这个问题?

谢谢。

+0

照照服务器错误日志。它会告诉你它不喜欢的.htaccess的哪一部分。 – Doon 2011-05-02 20:23:19

+0

导致问题的'tiny_mce_gzip.php'文件中存在*最可能的错误 - 如果删除了'.htaccess'文件,您是否仍然收到错误? – 2011-05-02 20:28:23

+0

我现在修改了它,将http://www.mydomain.com/subfolder/assets/17041f49的文件权限更改为555.现在一切正常。这是为什么? – 2011-05-02 20:35:41

回答

0

也许你可以试试:

RewriteRule ^(.*).(css|js|xml|ico|png|gif|jpe?g)$ $1.$2 [L] 
RewriteRule ^.*$ index.php [L,QSA] 

然后得到所请求的URL在PHP USIG

$url = $_SERVER["REQUEST_URI"];