[Catalyst] Local action in controller not mapping to template (retry): Solved

Kiki kiki at bsdro.org
Tue Apr 21 12:01:40 GMT 2009


Anne Brown wrote:
> Daniel Hulme-4 wrote:
>   
>> On Mon, Apr 20, 2009 at 08:20:42AM -0700, Anne Brown wrote:
>>     
>>> As you suggested, I checked the vhosts file and sure enough, the problem
>>> was
>>> with the RewriteRule.  I changed this:
>>>     RewriteRule ^([A-Za-z0-9-]+)?$ index.pl/$1 
>>> to this:
>>>     RewriteRule ^([A-Za-z0-9-/]+)?$ index.pl/$1
>>> and problem solved.
>>>       
>> Problem solved, that is, until you try to access an URL with a _ in it,
>> or with %-encoded characters, or a ~, all of which are common. I'm not
>> sure what you're trying to exclude from that RewriteRule, but .* seems
>> like the obvious regex to use.
>>
>>     
> Daniel,
>
> I tried that before but I must be doing something wrong.  This rule:
>     RewriteRule ^(.*)?$ index.pl/$1 
> results in a bunch of errors like this:
>     [TS] [error] [client 127.0.0.1] Request exceeded the limit of 10
> internal redirects due to... 
>     [TS] [debug] core.c(3046): [client 127.0.0.1] r->uri =
> /index.pl/index.pl/index.pl/index.pl/index.pl/index.pl/
>     [TS] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri =
> /index.pl/index.pl/index.pl/index.pl/index.pl/index.pl/index.pl/index.pl/index.pl/
>     [TS] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri =
> /index.pl/index.pl/index.pl/index.pl/index.pl/index.pl/index.pl/index.pl/
>     [TS] ....
>
> Anne
>   
Just tell mod_rewrite to stop rewriting the URL, in order to escape the 
infinite recursion (see 'recursion, infinite')

You probably need:

	RewriteRule ^(.*)?$ index.pl/$1 [L]

The [L] is a flag that tells mod_rewrite that this is the last rule and it should stop applying any more rules.

See also: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule





More information about the Catalyst mailing list