2012-05-22 38 views
1

我正在根據Tonic構建一個RESTful API。 在我的開發者機器和舞臺服務器上,我們使用虛擬主機。使用VirtualHost和mod_rewrite找不到文件

Tonic使用.htaccess文件將調入的調用轉換爲它的dispatcher.php文件。這在沒有啓用VirtualHosts的服務器上工作正常。

但是,如果我啓用VirtualHosts我找不到文件,甚至認爲該文件的路徑和名稱是正確的。

這是我的開發人員機器上的VirtualHost設置。

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerAlias *.dev.xxxxx 
    VirtualDocumentRoot /home/xxxxxxxx/workspace/%1 
    <Directory /home/xxxxxxxx/workspace/> 
      Options Indexes FollowSymLinks MultiViews 
      AllowOverride All 
      Order allow,deny 
      allow from all 
    </Directory> 

</VirtualHost> 

和滋補的.htacces位於一個名爲休息在項目的根文件夾中:

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteCond %{REQUEST_URI} !dispatch\.php$ 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule .* dispatch.php [L,QSA] 
</IfModule> 

http://project.dev.xxxxx/rest/買進期權給予:

Not Found 
The requested URL /home/xxxxxxxx/workspace/project/rest/dispatch.php was 
not found on this server. 

Apache/2.2.22 (Ubuntu) Server at xxxxxxx Port 80 

回答