
現在、すべてのユーザーのプロフィールページがパスに読み込まれていますhttps://example.com/ユーザー名それを変更してユーザープロフィールページをロードしたいhttps://ユーザー名.example.com。
私はウェブサーバーとしてnginxを使用しています。以下は私が試したサーバーブロックです
server {
listen 80;
server_name *.example.com;
if ($host ~ "^(.*)\.example\.com$") { set $subdomain $1;}
rewrite ^ $scheme://example.com/$subdomain$request_uri permanent;
}
これにより、*.example.comにアクセスしたユーザーはhttps://example.com/ユーザー名これはCodeIgniterのコントローラーです。URLをusername.example.comのままにして、コンテンツをロードして提供する方法はありますか?https://example.com/ユーザー名