From dc1261d703ae1e1a14841b030888e3f87ff7c38f Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Wed, 1 May 2024 21:45:52 -0500 Subject: prettier formatting and rewrap lines --- content/blog/2022-12-07-nginx-wildcard-redirect.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'content/blog/2022-12-07-nginx-wildcard-redirect.md') diff --git a/content/blog/2022-12-07-nginx-wildcard-redirect.md b/content/blog/2022-12-07-nginx-wildcard-redirect.md index e8339b9..277424b 100644 --- a/content/blog/2022-12-07-nginx-wildcard-redirect.md +++ b/content/blog/2022-12-07-nginx-wildcard-redirect.md @@ -20,7 +20,7 @@ Instead, I finally found a solution that allows me to redirect both subdomains AND trailing content. For example, both of these URLs now redirect properly using the logic I'll explain below: -``` txt +```txt # Example 1 - Simple base domain redirect with trailing content https://domain1.com/blog/alpine-linux/ -> https://domain2.com/blog/alpine-linux/ @@ -44,7 +44,7 @@ doas nano /etc/nginx/http.d/domain1.conf Within this file, I had one block configured to redirect HTTP requests to HTTPS for the base domain and all subdomains. -``` conf +```conf server { listen [::]:80; listen 80; @@ -66,7 +66,7 @@ For the base domain, I have another `server` block dedicated to redirecting all base domain requests. You can see that the `rewrite` line is instructing Nginx to gather all trailing content and append it to the new `domain2.com` URL. -``` conf +```conf server { listen [::]:443 ssl http2; listen 443 ssl http2; @@ -91,7 +91,7 @@ Once the server gets to the `rewrite` line, it pulls the `subdomain` variable from above and uses it on the new `domain2.com` domain before appending the trailing content (`$request_uri`). -``` conf +```conf server { listen [::]:443 ssl http2; listen 443 ssl http2; -- cgit v1.2.3-70-g09d2