wordpress を実行するサイト example.com があります。このブログをサブドメイン blog.example.com に移動したいのですが、次のことも必要です。
example.com --> static page (not wordpress)
blog.example.com --> new address to the blog
blog.example.com/foo --> handled by wordpress
example.com/foo --> permanent redirect to blog.example.com/foo
だから私はこの次の構成を試しました:
server {
server_name example.com;
location = / {
root /home/path/to/site;
}
location / {
rewrite ^(.+) http://blog.example.com$request_uri? permanent;
}
}
この場合、リダイレクトは完全に機能しています。残念ながら、example.com は blog.example.com にもリダイレクトされます。