Templates and rewrite directives not rendering actions

Hello,

I’m trying to set it up like this:
site.tld/something
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.
Example:
http://localhost:8080/includes/something.html
Welcome ::1! You're visiting /includes/something.html.

http://localhost:8080/something
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.