I'm running WordPress Network with custom domains on Google App Engine Standard Environment (so I can't use nginx or something).
What I want to do is to serve different static content for different domains but using the same path:
somedomain1.com/favicon.ico ----> static/somedomain1.com/favicon.ico
somedomain2.com/favicon.ico ----> static/somedomain2.com/favicon.ico
somedomain3.com/favicon.ico ----> static/somedomain3.com/favicon.ico
etc…
I tried to use domain names in app.yaml
URL handlers, but it ain't work for me:
handlers:
- url: (http|https)://somedomain1.com/favicon.ico
static_files: static/somedomain1.com/favicon.ico
upload: static/somedomain1.com/favicon.ico
Is this possible by means of the standard environment of App Engine?
You cannot use the app.yaml
URL routing for such purpose because the handler
url
configuration doesn't apply to the host/domain name portion of the URL, it only applies to the file path portion. From the url
row in the Handlers element table (emphasis mine):
url
Required element under handlers. The URL pattern, as a regular expression. The expression can contain groupings that can be referred to in the file path to the script with regular expression back-references. For example,
/profile/(.*)/(.*)
would match the URL/profile/edit/manager
and use edit and manager as the first and second groupings.
In other words this portion of your configuration is not really valid:
url: (http|https)://somedomain1.com/favicon.ico`
You could complement your WordPress static offering with a small app which could take care of dynamically selecting a particular artifact based on the domain in the request's URL.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments