nginx rewrite subdomain to file as a variable
- by ethree
How do you get the subdomain as a variable to add in a rewrite?
hello.example.com should go to example.com/user.php?u=hello but still display as just hello.example.com
I'm currently doing http://example.com/users/hello but would like to have Tumblr style domain names for users.
rewrite ^/users/(.*)$ /user.php?u=$1 last;
Also, if there are pages like /settings/ after the subdomain hello.example.com/settings/ I'll need to rewrite to a settings.php