I did it like this:
$router->addRoute('admin',
new
Zend_Controller_Router_Route('admin/:controller/:action',
array('controller' => 'admin',
'action' => 'index')));
This way the url still points to /admin, but that does not affect the
controller. I'm not sure I understand what the advantage is to using a
rewrite rule instead of a router.
Mark
On 6/4/07, clone45 <[EMAIL PROTECTED]> wrote:
Hello!
I'm using the Zend controller on a new site and have a newbie question. So
far, I've been using the controller without any problems. I want to add an
admin area to my site (www.mydomain.com/admin), and I think it would be best
to create a new series of controllers to handle *just* the admin area.
In my first attempt at solving this problem, I tried using the following
rewrite rules:
RewriteEngine on
RewriteRule admin admin_index.php [L]
RewriteRule !\.(js|ico|gif|jpg|png|css|swf)$ index.php
(On the side: admin_index.php is basically the same thing as the standard
index.php, but in it I specify a new path to the controllers directory,
namely ../application/controllers/admin. I'm putting my admin controllers
in there.)
My rewrite rule doesn't quite cut it. If I try to go to the page:
http://www.mydomain.com/admin, the request gets sent to admin_index.php,
like I want, but the action is set to "admin", since that's the first
parameter after the domain name.
I want to be able to say: http://www.mydomain.com/admin/products/list or
http://www.mydomain.com/admin/products/edit/id/12
Thanks for your thoughts on the subject! Am I approaching this correctly?
- Bret
--
Have fun or die trying - but try not to actually die.