Score:0

URL rewriting only in main domain

ve flag

I am trying to use a package to optimize my main site and when I follow the instructions it works great but it messes up all subdomains as well. Can I somehow exclude any subdomain from this location lookup ?

The change I need to make is this

location / {
    try_files $uri $uri/ /page-cache/$uri.html /page-cache/$uri.json /page-cache/$uri.xml /index.php?$query_string;
}

But I need this to be applied only to the main domain, any other subdomain should use this one

 location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

Is this possible?

Ivan Shatsky avatar
gr flag
You can split your server block in two, the first one for the main domain and the second one for the subdomains.
ve flag
Not sure how to do that. Can I use a wildcard character?
Ivan Shatsky avatar
gr flag
Yes, something like `server_name domain.com` (or `server_name domain.com www.domain.com`) for the first server block and `server_name *.domain.com` for the second one. [Here](http://nginx.org/en/docs/http/server_names.html) are the docs.
us flag
Please add your full nginx configuration given by `nginx -T` to your question.
djdomi avatar
za flag
more details needed
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.