I want to do a custom rewrite
for the subdomain on ISPconfig. When I add the code below for this, the subdomain is redirected to the main domain.
Sample #1:
server {
...
if ($http_host = "panel.example.com") {
rewrite ^(?!/(_SubDomains/Panel|stats|\.well-known/acme-challenge))/(.*)$ /_SubDomains/Panel/$2 last;
rewrite ^/(.*)/(.*)$ /index.php?cmd=$1&scd=$2? last;
}
...
}
If I do as in example two, Nginx server does not work.
Sample #2:
server {
...
if ($http_host = "panel.example.com") {
rewrite ^(?!/(_SubDomains/Panel|stats|\.well-known/acme-challenge))/(.*)$ /_SubDomains/Panel/$2 last;
location ~ \.php$ {
rewrite ^/(.*)/(.*)$ /index.php?cmd=$1&scd=$2? last;
}
}
...
}
How can I do subdomain-specific rewrite?