Redirect to url based on current year/month I've got a calendar template set up and would like to have http://domain.com/calendar redirect to http://domain.com/calendar/current_year/current_month but am having trouble getting this to work.

My current code is:

{% if craft.request.segment(2) == "" %}
  {% redirect "calendar/{{ now.year }}/{{ now.month }}" %}
{% endif %}


But this ends up going to a 404 with this url:
http://domain.com/calendar/%7B%7B%20now.year%20%7D%7D/%7B%20now.month%20%7D/
You never use {{ echo tags within other Twig tags. What you have to do instead is to use string concatenation.
{% redirect "calendar/" ~ now.year ~ "/" ~ now.month %}