2015-06-22 27 views
1

我已經安裝了一個具有虛擬主機的Ubuntu服務器,在該文件夾中:/var/www/vhosts/dev.blla.com/httpdocs/src是使用zend框架1構建的web應用程序。 問題是我有一個.htaccess文件,如下圖所示:.htaccess與虛擬主機zend框架1 ubuntu

<VirtualHost dev.blla.com:80> 
    ServerName dev.blla.com 
    DocumentRoot /var/www/vhosts/dev.blla.com/httpdocs 

    RewriteEngine off 

    <Location /> 
     RewriteEngine On 
     RewriteCond %{REQUEST_FILENAME} -s [OR] 
     RewriteCond %{REQUEST_FILENAME} -l [OR] 
     RewriteCond %{REQUEST_FILENAME} -d 
     RewriteRule ^.*$ - [NC,L] 
     RewriteRule ^.*$ index.php [NC,L] 
    </Location> 
</VirtualHost> 

的.htacess文件位於/var/www/vhosts/dev.blla.com/httpdocs,網頁顯示500 Internal Server Error我究竟做錯了什麼?

在錯誤日誌中我有這樣一行:/var/www/vhosts/dev.blla.com/httpdocs/.htaccess: <VirtualHost not allowed here, referer: http://dev.blla.com/

虛擬主機文件:

<VirtualHost *:7080> 
     # The ServerName directive sets the request scheme, hostname and port that 
     # the server uses to identify itself. This is used when creating 
     # redirection URLs. In the context of virtual hosts, the ServerName 
     # specifies what hostname must appear in the request's Host: header to 
     # match this virtual host. For the default virtual host (this file) this 
     # value is not decisive as it is used as a last resort host regardless. 
     # However, you must set it for any further virtual host explicitly. 
     #ServerName www.example.com 

     ServerAdmin [email protected] 
     DocumentRoot /var/www/html 

     # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 
     # error, crit, alert, emerg. 
     # It is also possible to configure the loglevel for particular 
     # modules, e.g. 
     #LogLevel info ssl:warn 

     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 

     RewriteCond %{REQUEST_FILENAME} -s [OR] 
     RewriteCond %{REQUEST_FILENAME} -l [OR] 
     RewriteCond %{REQUEST_FILENAME} -d 
     RewriteRule ^.*$ - [NC,L] 
     RewriteRule ^.*$ index.php [NC,L] 

     # For most configuration files from conf-available/, which are 
     # enabled or disabled at a global level, it is possible to 
     # include a line for only one particular virtual host. For example the 
     # following line enables the CGI configuration for this host only 
     # after it has been globally disabled with "a2disconf". 
     #Include conf-available/serve-cgi-bin.conf 
</VirtualHost> 

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 
+0

檢查以確保您啓用了阿帕奇 – MiltoxBeyond

+0

的重寫模塊啓用它通過返回模塊重寫a2enmod重寫檢查已啓用 – Arlind

+0

嘗試移除說RewriteEngine敘述斷了線,只是爲了確保。否則,嘗試更簡單的重寫。類似於'RewriteCond%{REQUEST_FILENAME}!-f RewriteCond%{REQUEST_FILENAME}!-d RewriteRule ^(。*)$ index.php [NC,L]' – MiltoxBeyond

回答