絶対URLを生成するために、間違ったドメインを使用します仮想ホストで、私の回答が正しい:symfonyは私の設定ファイルである私は現在、ここ<a href="https://github.com/willdurand/BazingaHateoasBundle" rel="nofollow noreferrer">BazingaHateoasBundle</a>とsymfony 2.7</p> <p>とハルHATEOAS RESTfulなAPIを構築しています
:私のdevのサーバーで{
"id":1,
"_links": {
"self": {
"href": "http://dev.myvhost/api/myentity/1"
}
}
、私はこのような何かを持っています
{
"id":1,
"_links": {
"self": {
"href": "http://my-machine-name/api/myentity/1"
}
}
代わりにmy-machine-name
ではなく、my-server-name.com
とします。
そして、私のサーバーのApacheの設定は、次のようになります。
ServerName my-server-name.com
Alias "/api" "/var/www/api/web"
<VirtualHost *:80>
<Directory /var/www/api/web>
AllowOverride None
Require all granted
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /api/app.php [QSA,L]
</IfModule>
</Directory>
<Directory /var/www/api/web/bundles>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
ErrorLog /var/log/httpd/api_error.log
CustomLog /var/log/httpd/api_access.log combined
</VirtualHost>
は、私は多分、直接ホストを設定することができるようにsymfonyの設定をする方法はありますか?