apache2 サブレベルドメインから URL へのリダイレクト

apache2 サブレベルドメインから URL へのリダイレクト

myservice.example.comをリダイレクトする必要がありますこのサイト

これまでの私の試み: apache2 に新しい設定を追加し、a2ensite を実行して apache2 を再起動します。

<VirtualHost *.80>
 DocumentRoot /var/www/html
 ServerAdmin [email protected]
 ServerName myservice.example.com
 RedirectPermanent / https://www.example.com/myservice
</VirtualHost>

<VirtualHost *.443>
 DocumentRoot /var/www/html
 ServerAdmin [email protected]
 ServerName myservice.example.com
 RedirectPermanent / https://www.example.com/myservice
</VirtualHost>

しかし、myservice.example.comを入力すると、apache2が私にサービスを提供します参考文献、 ないこのサイト

何が足りないのでしょうか?

答え1

リダイレクト設定は正しいです。

ただし、ディレクティブ内の IP とポートの間のピリオドをVirtualHostコロンに置き換える必要があります。

例えば<VirtualHost *:80><VirtualHost *:443>

関連情報