How to port Apache rewrite rules to cherokee?
I'm pretty new to cherokee, it's great and pretty straight forward except URL Rewrites. Is there a straight forward guide to it? Let me know.
Also how would I port this:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Thanks
Solution 1:
Assuming that you are using the default server and you have already set the PHP FastCGI handler:
- Go to Virtual Servers.
- Select your server.
- Click on "Behavior" tab
- Edit the "Default" rule.
- Change its "Handler" to "Redirection"
- The interface would change. Now fill the fields:
- Type: Internal = server side, External = client side
- Regular expression: ^(.*)$
- Substitution: /index.php?q=$1
- All your other URL rewrites should be added there.
That should work for your rule.
Notes: Behavior rules orders matters so.. place your PHP handler on top and set it to be non-final. For static content like CSS or images you should create new rules ( type: directory, handler: static content ).
I hope this helps you. Bye!
p.d: If you need them, I can make some screens.
Solution 2:
You just need to stack several handlers for the virtual host.
First you need the Static Content or the List & Send handler to mimic the RewriteCond
statements followed by a Redirection handler to mimic the actual RewriteRule
statement.
There could be problems with the QSA
flag, though...