October 17, 2021
If you want your www
subdomain (like www.example.com
) to redirect to your ābareā or ānakedāĀ domain (like example.com
), you can tell the Caddy server to do that redirect.
To do this, youāll edit your Caddyfile
, which is the configuration file for Caddy. My configuration file was located at /etc/caddy/Caddyfile
on the server.
To edit it using the nano
text editor, I ran:
nano /etc/caddy/Caddyfile
Then, I modified the contents to be like this:
www.benborgers.com {
redir https://benborgers.com{uri}
}
benborgers.com {
# Your real site configuration.
}
The www
redirect needs to be above your real siteās configuration, so that the redirect works.
Save that configuration and reload Caddy. Now, the www
subdomain will redirect to the appropriate page on your www
-less domain!
Tufts Meal Plan Wrapped
Mar 2, 2024
Building an e-ink picture frame that displays an iCloud photo album
Jan 9, 2024
2023 in review
Jan 5, 2024
Subscribe to my newsletter for a monthly round-up of new blog posts and projects Iām working on!