2016-11-17 111 views
1

我們已將我們的apache版本從2.2升級到2.4。現在我們正面臨着htaccess文件的問題。我在htaccess文件中添加了垃圾數據。現在它的工作原理是這樣的:htaccess不適用於文件

1) http://example.com:8080/ : 500 internal error 
2) http://example.com:8080/index.php : showing the content of index.php file. 
2) http://example.com:8080/login.php : File not found 
3) http://example.com:8080/phpinfo.php : showing the content 

現在我不明白是什麼問題。 htaccess不適用於文件。它只爲root工作。 Apache的配置內容:

<VirtualHost *:8080> 
    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/example-test-apache-24/site/shadow-site/$1 
    UseCanonicalName On 
    loglevel emerg 

    DocumentRoot /var/www/html/example-test-apache-24/site/shadow-site 
    <directory "/var/www/html/example-test-apache-24/"> 
    options followsymlinks 
    AllowOverride All 
    Order allow,deny 
    Allow from all 
    </directory> 
    ErrorLog /opt/rh/httpd24/root/etc/httpd/logs/siteerror_log 
</virtualhost> 

編輯1: 我剛纔注意到,htaccess的工作圖片,CSS和JS文件。看起來像它不適用於PHP文件只。

+0

對不起林困惑我從改變ProxyPassMatch線。你說它不適用於文件,但是在第一個塊中你聲明它適用於index.php和phpinfo.php。另外,當你說它只適用於「root」時,請澄清你的意思嗎? – TDWebDev

+0

htaccess不適用於文件。根據我的代碼(在htaccess文件中的垃圾代碼),沒有文件應該工作。像login.php和phpinfo.php也應該顯示500內部錯誤。但它顯示了文件的內容。 – munjal

+0

嗯,仍然不知道我明白,但如果你最近升級了你的apache版本,那麼apache配置文件也有可能被改變了。它可能會重置/刪除覆蓋較低子目錄中的htaccess文件的功能。你知道如何檢查嗎? – TDWebDev

回答

0

我終於找到了我的問題的答案。這是因爲ProxyPassMatch。

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/example-test-apache-24/site/shadow-site/$1 

要:

ProxyPassMatch ^/(index\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/example-test-apache-24/site/shadow-site/$1 

現在它工作正常,我:)

相關問題