Rewrite on {>Accept-Language}


I’m currently struggling with rewrite based on the Client-Browser’s Accept-Language.

My public_html folder looks like this:
→ there is no index.html file! (so simply accessing domain.tld brings up a 404 without any rewrite rule)

Currently, i’m using the following code (and also played around a bit with the {path} directives but without any result, still getting a 404):

rewrite / {
if {>Accept-Language} has de
to {path} {path}/ /index-de.html
rewrite / {
if {>Accept-Language} not_has de
to {path} {path}/ /index-en.html

Would be glad if you could help me to get this properly working :slight_smile:

Best Regards

Unsure why that rewrite isn’t working, but I note what you’re doing looks very similar to the example on this github page for the Caddy locale middleware.

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