Mailing List Archive

Conditional Redirections
Hi,

I'm trying to work out if it's possible to do redirections for PHP page
controllers like so:

^/(.*)/(,*)$ redirects to /$1.php&some_parameter=$2
^/(.*)$ redirects to /$1.php


With an added rule to fall back to if $1.php doesn't actually exist.

^/(.*)/(.*)$ redirects to /index.php&some_parameter=$2
^/(.*)$ redirects to /index.php


I've previously just written a similar rule (in Cherokee and Apache) for
each page like:

/my_page/(.*)$ redirects to /my_page.php?param=$1

which works but can end up with loads of rules.

Currently I have the $1.php redirection working but it gives an internal
server error if i try to access the site root. The redirection rule is set
to non final just below my PHP rule.

Thanks in advance
Re: Conditional Redirections [ In reply to ]
On 09/02/12 22:26, Derwent Ready wrote:
> Currently I have the $1.php redirection working but it gives an internal
> server error if i try to access the site root. The redirection rule is
> set to non final just below my PHP rule.

Usually the internal error happens if the match, passes the request to
the redirection handler, but in the redirection handler there is no
redirection for it.

You could set something up like / => ...


Stefan
_______________________________________________
Cherokee mailing list
Cherokee@lists.octality.com
http://lists.octality.com/listinfo/cherokee