0

So currently all users profile page are loaded on path https://example.com/username. i want to change that and load user profile page on https://username.example.com.

i am using nginx as web server,below is the server block i have tried

server {
    listen 80;
    server_name *.example.com;
    if ($host ~ "^(.*)\.example\.com$") { set $subdomain $1;}
    rewrite ^ $scheme://example.com/$subdomain$request_uri permanent;
}

this redirects anyone who visit *.example.com to https://example.com/username which is my controller in CodeIgniter. is there a way to keep the url as username.example.com and load serve the content from https://example.com/username

0 Answers0