7 ms·
> So, I decided to create a redirect on Nginx for each old URL, pointing to the new one. It was quite frustrating to write all those redirects… You can use a r
by biohazard2 2y ago
> So, I decided to create a redirect on Nginx for each old URL, pointing to the new one. It was quite frustrating to write all those redirects…
You can use a regular expression to write a single redirect for all the posts. Something like the following could do the trick:
location ~ ^/(home|networking|misc|tips)/(\d{4})/(\d{2})/(\d{2})/([a-zA-Z0-9-_]+)\.html {
return 301 https://giuliomagnifico.blog/post/$2-$3-$4-$5/;
}
- giuliomagnifico 2y agoDamn! I didn’t know that Nginx handles regex! Thank you. This would have saved me quite a bit of time… but I already did it.