Thanks for answering.
On 2011-11-01, at 02:53, Daniel Lo Nigro wrote:
> One simple way I can think of, I didn't test this though:
> Create a final "File Exists" behaviour using "List & Send" handler to serve
> all your pages
> Change the default behaviour to use the "Redirection" handler"
> Add all your pages as regular expressions (eg. /home\.html) to this behaviour
If I understand correctly, this will not work because the file doesn't exists!
So the rule will not catch 'home.htm' that should be redirected to 'index.html'
('home.htm' doesn't exists).
> Another option is to create a "Not file exists" rule (by creating a File
> Exists rule and then clicking the "NOT" button). But I assume one of these is
> what you're already doing.
Unfortunately it doesn't work either because it will by applied to all files
that don't exists, but in general these requests should be handle by my Django
app.
> By "bit heavy" did you mean it was causing performance issues, or are you
> just worried about potential performance impacts?
No, I mean "A bit heavy to write and maintain". If I could do simple list of
matches and redirections, it will be more light!
> Another option is to create a script (for example, a PHP script) and redirect
> all 404s to it, and have the script try to work out where to redirect to.
> This would essentially move all the redirect logic into a single script, and
> might end up more efficient than using a large number of regular expressions
> (as you can do simple string matching in your script). This can easily be
> done by using the "custom redirections" option on the "error handler" tab and
> adding an internal 404 redirect to /404.php (or whatever you call the script).
I know I can do this kind of approach with my Django app, but I find it stupid
to handle that at the application level when is just a list of matches with
redirections. It's a nice job for a web server.
I found a new solution that is a little bit better. I'm using the Full Path
Rule, adding one path for each bad URL, and adding a new Regex for each file in
the Redirection Handler. This way I only have one Rule. It's mostly a list of
matching URL with redirections but I have to copy the bad URL 2 times (in the
rule and then in the handler) and in the handler I need to write it as a Regex.
I also need to be careful that a Regex will not match another URL in the list.
In the Rule tab:
Full Path
- /home.htm
- /about_us.htm
- ...
And in the Handler tab:
Redirection
- External | /home\.htm$ | index.html
- External | /about_us\.htm$ | about.html
- ...
Etienne
> - Daniel
>
> On Tue, Nov 1, 2011 at 4:53 AM, Etienne Desautels <[email protected]> wrote:
>
> Hi,
>
> How I'm supposed to do simple page redirections in Cherokee.
>
> For example if I have some old pages/URL that no longer exits and I want the
> redirect theses URL to other existing URL like:
>
> /home.htm -> /index.html
> /about_us.htm -> about.html
> ...
>
> I have like 20 or more redirections like this to do. The only way I found
> right now is to create a new Regex Rule for each URL with a redirection Regex
> Handler. But I found this solution a bit heavy.
>
> Thanks
>
> Etienne
> _______________________________________________
> Cherokee mailing list
> [email protected]
> http://lists.octality.com/listinfo/cherokee
>
_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee