Rewrite Subdomains to Paths

Hey,

Is it possible to rewrite subdomains to paths? I want to do something
like
this:

x.example.com/foo/bar/ -> www.example.com/x/foo/bar/

Thanks!

  • Kurtis

On Thursday 22 March 2012 00:15:00 Kurtis Mullins wrote:

Hey,

Is it possible to rewrite subdomains to paths? I want to do something like
this:

x.example.com/foo/bar/ -> www.example.com/x/foo/bar/

server {
    server_name ~^(?P<subdomain>.+)\.example\.com$;

    location / {
        return 301 http://www.example.com/$subdomain$request_uri;
    }
}

wbr, Valentin V. Bartenev

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs