Serve WordPress page at subdomain

February 17, 2014 2.2k views
How can I configure the Nginx Virtual Host to serve www.mydomain.com/status (a WordPress page) when a visitor visits status.mydomain.com? Note: I do not want a rewrite (I want the visitor to see the subdomain url). Also, I would like to rewrite visits to the page (mydomain.com/status) to status.mydomain.com . I have searched for a long time trying to solve this, but have had no luck. Thanks!
1 comment
  • My Comment might be late but really effective, i have developed a WordPress Plugin which does the job, i have used WordPress Re-write rule hooks to accomplish this, which make it light weight and doesn't have any effect on server. all you need is WildCard Subdomain.
    Here is the link:
    https://webostock.com/market-item/wordpress-page-as-subdomain-pro/8860/

    May be you have already find a solution, but this might help the other users. :)

    Regards
    Alisaleem252

1 Answer
To setup a domain or subdomain you do it the same way, here's an example of a nginx block to serve a Wordpress site:

http://wiki.nginx.org/Wordpress

Just replace the server_name directive with your subdomain.

For the redirection, in your main domain's block add something like:


location /status {
return 301 $scheme://subdomain.domain.com$request_uri;
}


Contact me if you need any more help ;D

http://johnqunknown.me/about/
Have another answer? Share your knowledge.