Templates and rewrite directives not rendering actions


I’m trying to set it up like this:
Should load: includes/something.html

This works fine with the following config

ext .html
root ./public
templates /includes .html
rewrite {
    if {file} not favicon.ico
    to {path} {path}/ includes/{path}.html

But the problem is that it’s not rendering the template actions unless i go directly to the path.
Welcome ::1! You're visiting /includes/something.html.

Welcome {{.IP}}! You're visiting {{.URI}}.

Any ideas?

It’s probably because your rewrite is stripping the extension off the URL, so templates doesn’t see the .html which is needed in order to activate the template parsing.

That sounds like a perfectly reasonable explanation. I’ll have to rethink my solution and see if I can get it working some other way.

Thank’s for the response, and thank you for Caddy :slight_smile:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.