This is a weird one. I have three domains, let's call them domain1.com, domain2.com and domain3.com.
Domain1.com is the main domain.
Domain2.com is a domain alias of domain1.com
Domain3.com is a domain alias of domain2.com
I am using the domains WITHOUT a 301 redirect. I don't want to get into too many details, but this is necessary in this case.
In my nginx settings for domain1.com, I have the following setting:
The idea is that when someone accesses "https://www.domain1.com/item/whatever", the requested is routed internally to item.php.
If requesting:
The bizarre behavior starts when requesting an item that doesn't exist. The correct behavior is for the item.php script to receive the request and respond that the item does not exist. However, here is what happens:
Things I have tried:
Domain1.com is the main domain.
Domain2.com is a domain alias of domain1.com
Domain3.com is a domain alias of domain2.com
I am using the domains WITHOUT a 301 redirect. I don't want to get into too many details, but this is necessary in this case.
In my nginx settings for domain1.com, I have the following setting:
Code:
location /item {
try_files $uri $uri/ /item.php?id=$uri;
}
The idea is that when someone accesses "https://www.domain1.com/item/whatever", the requested is routed internally to item.php.
If requesting:
- https://www.domain1.com/item/whatever
- https://www.domain2.com/item/whatever
- https://www.domain3.com/item/whatever
The bizarre behavior starts when requesting an item that doesn't exist. The correct behavior is for the item.php script to receive the request and respond that the item does not exist. However, here is what happens:
- https://www.domain1.com/item/nonexistingitem -- correct behavior. Item.php receives requests and says item does not exist.
- https://www.domain2.com/item/nonexistingitem -- correct behavior. Item.php receives requests and says item does not exist.
- https://www.domain3.com/item/nonexistingitem -- incorrect behavior. Nginx returns its standard 404 File Not Found page. The request is obviously never sent to item.php.
Things I have tried:
- Deleting domain2.com and domain3.com and adding them again as domain aliases. No change.
- `plesk repair web domain1.com` to rebuild the configuration. No change.
- Looked at the files in /var/www/vhosts/system/domain1.com/conf/ to see if domain2.com or domain3.com are treated differently in the settings. There is no difference.
- Restarted Apache and nginx. (Proxy mode is turned off for these domains, they should be using nginx only.) Still nothing.