# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
4. Error messages and/or full log output:
run: adapting config using caddyfile: parsing caddyfile tokens for 'rewrite': /root/downloads/config:10 - Error during parsing: Wrong argument count or unexpected line ending after '/index.php?q={http.matchers.path_regexp.myregex.1}'
5. What I already tried:
Googled and looked through community. Here is the topic.
The solution there is for V1 and does not work as rewrite directive changed…
However when i try to use matcher a it gives me an error of unknown directive, so I had to change it to @a and now I have this parsing unexpected. So basically lost.
Help needed
Can someone can help to adapt that original apache rewrite to V2 Caddy so i can try to run modx?
Thank you for the prompt reply. It does work, but much better than I expected… still need to find a solution to mimic -f -d from original .htaccess as now it send everything to that index.php, however if the file is there - it should just server it as it does with .css and others.
This will match is only if there is no existing file on disk for {path}. Otherwise, it’ll rewrite. I’m pretty sure the regex in your config is unnecessary, I think the {path} placeholder is all you need for what you’re trying to do.
Edit: Actually I think even simpler:
try_files {path} /index.php?q={path}
There’s a try_files directive which is a shortcut for this sort of thing. Not 100% certain it’ll work the way you need it to, but give it a shot!
It really is. I mean this is the solid solution helping thousands around the world. Does not matter if it is free or paid. This is still a product. A very very good product btw. So, please no offence here.
And I would really like more and more start using this blazing fast server and this requires more use case scenarios for general not that tech savvy users. It is done already for V1 so I am sure when V2 would be a full release there would be a much better knowledge base which would help all of us.