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? Op 16 nov 2010, om 12:49 heeft Colin Guthrie het volgende geschreven: > 'Twas brillig, and Laurens van Vliet at 16/11/10 11:11 did gyre and gimble: >> Hi, >> >> I was wondering if it is possible to add some basic RewriteRules to the ZF >> .htaccess? >> Is it possible to match certain urls while there is not a corresponding >> Controller/Action/View or Routes configured for these paths? >> >> Something like: >> >> SetEnv APPLICATION_ENV development >> >> RewriteEngine On >> RewriteRule ^foo http://%{HTTP_HOST}/bar [R=301,NC] >> >> RewriteCond %{REQUEST_FILENAME} -s [OR] >> RewriteCond %{REQUEST_FILENAME} -l [OR] >> RewriteCond %{REQUEST_FILENAME} -d >> RewriteRule ^.*$ - [NC,L] >> RewriteRule ^.*$ index.php [NC,L] >> >> where 'foo' is not existing in the ZF application and 'bar' is. >> So '.../foo' which is not really existing in my application should be >> redirected to '../bar' which has an existing BarController with actions and >> views. > > Is this not working for you? So you seem to be asking a question and > presenting a solution but not actually stating if you have a problem > with it! > > The code looks OK at first glance (albeit it only matches "/foo", not > "/foo/wibble/oink"), although I would put an L in the flags to stop it > processing any further rules and issue the 301 redirect immediately. > > 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/] >
