سؤال

I have a bunch of subdomain http://product.domain.com that I would like to redirect to http://www.domain.com/product.

Of course, the product name can be different, and the redirect has to be done accordingly.

Any pointers?

Thanks

هل كانت مفيدة؟

المحلول

try something that could include several subdomains, like this

server {
        server_name  ~^(sub1|sub2|sub3|sub4).example.com;
        return 301 $scheme://example.com/$1;
}

نصائح أخرى

Try this:

server {
    listen 80;

    server_name product.domain.com;

    return 301 http://www.domain.com/product$request_uri;
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top