If you are working on a staging environment that contains domains that are not configured on the production shop, you can easily redirect those domains to staging rather than serving the default storefront.
To do this, first create a /data/web/nginx/http.staging_redir_mapping
file containing:
1 2 3 4 5 |
map $http_host $staging_site { hostnames; default 0; test.example.nl 1; } |
Next, create a snippet to redirect all sites mapped as staging_site to the staging environment.
To do this, create a /data/web/nginx/server.staging_redir
file containing:
1 2 3 |
if ($staging_site = 1) { return 301 http://$http_host:8888$request_uri; } |
Now all traffic for domains that are mapped as staging_domain, will redirect to the same URL but on port 8888.