Tonicに基づいたRESTfulAPIを構築しています。私の開発者マシンとステージサーバーでは、仮想ホストを使用しています。
Tonicは、.htaccessファイルを使用して、着信呼び出しをそのdispatcher.phpファイルに変換します。これは、VirtualHostsが有効になっていないサーバーで正常に機能します。
ただし、VirtualHostsを有効にすると、ファイルへのパスと名前が正しいにもかかわらず、ファイルが見つかりません。
これが私の開発者マシンでのVirtualHostのセットアップです。
<VirtualHost *:80>
ServerAdmin admin@xxxxxxxxxxxx
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>
そして、プロジェクトルートのrestというフォルダにあるTonicの.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