Arjan van der Gaag has a really nice solution for redirects like this. According to his nanoc-template
wiki on that topic, you'll only need to add some info to your config.yaml
:
redirects:
-
from: /foo
to: /bar
-
from: /baz
to: /qux
Then configure your htaccess
file to include these settings:
<% if @site.config[:redirects] %>
# Set up URL redirects<% @site.config[:redirects].each do |h| %>
Redirect 301 <%= h[:from] %> <%= h[:to] %>
<% end %><% end %>
(Confer https://github.com/avdgaag/nanoc-template/blob/master/content/htaccess.txt)
The result will look like this:
Redirect 301 /foo /bar
Redirect 301 /baz /quz
A 301
("Moved Permanently") will be too harsh in this case, though: you'll want a 303 redirect ("See other").