Difference between revisions of "Return (nginx.conf)"
Jump to navigation
Jump to search
Tags: Mobile web edit, Mobile edit |
|||
Line 10: | Line 10: | ||
} | } | ||
− | https://stackoverflow.com/questions/45318758/nginx-variable-for-subdomain | + | [[Subdomain redirection]]: https://stackoverflow.com/questions/45318758/nginx-variable-for-subdomain |
server { | server { | ||
[[listen]] 80; | [[listen]] 80; |
Revision as of 10:04, 27 August 2021
HTTP to HTTPS redirection example:
server { listen 80 default_server; server_name _; return 301 https://$host$request_uri; }
Subdomain redirection: https://stackoverflow.com/questions/45318758/nginx-variable-for-subdomain
server { listen 80; server_name ~^(?<mysubdomain>.+)\.example\.com$; return 301 http://example.com/$mysubdomain$request_uri; }
Related terms
- Configure HTTP to HTTPs redirection with Nginx
- AWS ALB: Redirect (AWS::ElasticLoadBalancingV2::Listener)
rewrite
See also
Advertising: