Tonic을 기반으로 RESTful API를 작성하고 있습니다. 개발자 머신과 스테이지 서버에서 가상 호스트를 사용합니다.VirtualHost 및 mod_rewrite에서 파일을 찾을 수 없습니다.
토닉은 .htaccess 파일을 사용하여 incomming 호출을 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