aboutsummaryrefslogtreecommitdiff
path: root/content/blog/2022-12-07-nginx-wildcard-redirect.md
diff options
context:
space:
mode:
authorChristian Cleberg <hello@cleberg.net>2024-05-01 21:45:52 -0500
committerChristian Cleberg <hello@cleberg.net>2024-05-01 21:45:52 -0500
commitdc1261d703ae1e1a14841b030888e3f87ff7c38f (patch)
tree71139c9021b09704b2d45be3b64d54e2acbae55f /content/blog/2022-12-07-nginx-wildcard-redirect.md
parentba6b552c8256cc2e071c910ef7821c82443f1f82 (diff)
downloadcleberg.net-dc1261d703ae1e1a14841b030888e3f87ff7c38f.tar.gz
cleberg.net-dc1261d703ae1e1a14841b030888e3f87ff7c38f.tar.bz2
cleberg.net-dc1261d703ae1e1a14841b030888e3f87ff7c38f.zip
prettier formatting and rewrap lines
Diffstat (limited to 'content/blog/2022-12-07-nginx-wildcard-redirect.md')
-rw-r--r--content/blog/2022-12-07-nginx-wildcard-redirect.md8
1 files changed, 4 insertions, 4 deletions
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;