I believe what you're wanting is something more along the lines of 

RewriteRule ^foo(.*)$ bar$1 [R=301,NC,L]

That will rewrite foo/action/ to bar/action/
Note that it will also rewrite foo-dat-i-piddy/action" to
bar-dat-i-piddy/action

Cheers,
David


Colin Guthrie-6 wrote:
> 
> 'Twas brillig, and Laurens van Vliet at 16/11/10 11:57 did gyre and
> gimble:
>> Problem with this code is that it is not working.
>> 
>> When I try to open in my browser my application with /foo at the end of
>> the url, say for example: http://www.example.com/foo
>> then I get this error message:
>> Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception'
>> with message 'Invalid controller specified (foo)'
>> 
>> Is it possible to use the RewriteRule without any FooController or Routes
>> for /foo?
> 
> Yes this is possible, you've just got the syntax wrong.
> 
> "^foo" will match URLs *beginning* with foo, not ending with foo.
> 
> Try, "foo$" to match all URLs ending with foo, or perhaps,
> 
> "^/foo$" to match a URL of http://example.com/foo
> 
> And make sure you put the L flag into the rewrite ([R=301,NC,L]) so that
> it does not then process the rest of the rules.
> 
> Col
> 
> 
> -- 
> 
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
> 
> Day Job:
>   Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>   Mageia Contributor [http://www.mageia.org/]
>   PulseAudio Hacker [http://www.pulseaudio.org/]
>   Trac Hacker [http://trac.edgewall.org/]
> 
> 
> 

-- 
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/How-to-add-RewriteRule-to-ZF-default-htaccess-tp3044603p3049946.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to