Redirecting old urls with dates?

Hi, I’m moving from Jekyll to Zola. Everything works great, but my problem is that the old url for my blog was like this:


And now with Zola, it looks like this:

Is there a way to either remake the old url structure or redirect old links to new ones?

I am using Apache2 server for this, so if there’s something I can do with that, that also works for me.

Found help from fediverse :slight_smile:

In short, i just added aliases = ["/2023/04/16/AksDar-colorscheme.html "]
to the config block of the post (the one marked with +++)

Works well!


Here is an alternative.

I had the same problem while porting a website from WordPress to Zola (served by Apache2). Since I had to maintain a .htaccess in the root of my webspace to maintain the Content-Security-Policy, Referrer-Policy, X-XSS-Protection, X-Content-Type-Options, X-Frame-Options, and Strict-Transport-Security headers, I used Apache2’s mod_rewrite.c to do the rewriting:

RewriteEngine On
RedirectMatch 301 /2023/04/16/AksDar-colorscheme.html /posts/aksdar-colorscheme

You can use Regular Expressions if there is a pattern in the mapping, but it’s also fine to map each URL separately by adding more RedirectMatch lines.

1 Like

Ah, handy! Thanks for sharing.