1

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
4

1 に答える 1

0

を悪用しているように見えますVirtualDocumentRoot。次のように変更してみてください。

DocumentRoot /home/xxxxxxxx/workspace/project/rest

また、ここに についての良い説明がありVirtualDynamicRootます:動的に構成されたマス仮想ホスティング

それが役立つことを願っています。

于 2012-05-22T13:24:19.713 に答える