From dc6db80fa72286704849ef61ee0e5ccb5841cb09 Mon Sep 17 00:00:00 2001 From: Bradley Taunt Date: Tue, 2 Jul 2024 14:28:49 -0400 Subject: Conversion to barf for testing purposes --- _posts/2021-12-03-netlify-urls.md | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 _posts/2021-12-03-netlify-urls.md (limited to '_posts/2021-12-03-netlify-urls.md') diff --git a/_posts/2021-12-03-netlify-urls.md b/_posts/2021-12-03-netlify-urls.md deleted file mode 100644 index fdad5e3..0000000 --- a/_posts/2021-12-03-netlify-urls.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -layout: post -title: "Using Netlify for Dynamic URL Redirects" -date: 2021-12-03 ---- - - -With the [recent domain switch](/minor-website-changes/) that took place on this website, I needed to have a dependable setup to forward my old domain URLs to the new one. While using something like "URL forwarding" through your domain provider could work, it doesn't natively support *dynamic* linking. Let me explain using a basic example: - -- A user clicks on a link that targets a post on your old domain:
`olddomain.com/random-post` -- You want that link to forward using the same permalink structure:
`newdomain.com/random-post` -- "URL forwarding" through your domain provider **does not** support this - -Simple stuff. So, let's breakdown how to easily set this up on Netlify *for free*. - -## Setting Up Netlify - -- Create an account (or login to an existing one) and setup a new site[^1] -- Change your "old" domain name nameservers to match Netlify's (normally done through your domain register) - - `dns1.p03.nsone.net` - - `dns2.p03.nsone.net` - - `dns3.p03.nsone.net` - - `dns4.p03.nsone.net` -- Back in Netlify: under **Domain Settings** you need to add your custom "old" domain under the **Custom domains** section under **Domain management** -- Lastly, add the following content inside a `_redirects` file (no extension) to your website content/build (changing to your own domains, of course) - - - https://olddomain.com/* https://newdomain.com/:splat 301! - - -That's it! Now Netlify will dynamically forward all your pre-existing URLs from your old domain to the new one. No pesky `.htaccess` files or running your own basic web server(s)! - -Hopefully this helps others trying to dynamically redirect their domains without the headache. - -[^1]: I normally set this up through Github / git hosting -- cgit v1.2.3-54-g00ecf