URL Re-writing

3 views
Skip to first unread message

Randell

unread,
Oct 12, 2010, 4:09:39 AM10/12/10
to zfdeve...@googlegroups.com
Hi guys,

I have a URL that looks like /controllername/actionname/firstparametername/firstparametervalue. How can I rewrite it using the Zend Framework way such that it will be redirected to and accessible using /controllername/firstparametervalue?


Thanks,
--
Randell

Patrickmccanna

unread,
Oct 12, 2010, 11:12:56 AM10/12/10
to zfdeve...@googlegroups.com
Did you try creating a custom .htaccess file?


--
You received this message because you are subscribed to the Google Groups "Zend Framework Developers" group.
To post to this group, send email to zfdeve...@googlegroups.com.
To unsubscribe from this group, send email to zfdevelopers...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/zfdevelopers?hl=en.

Randell

unread,
Oct 12, 2010, 9:33:10 PM10/12/10
to zfdeve...@googlegroups.com
Hi Patrick,

I was actually trying to avoid messing with the .htaccess file since I'm already using Zend and I wanted to do it the Zend way. In any case, I was able to make a simple routing with the help of these links:
Cheers,
--
Randell Benavidez

Judah Anthony

unread,
Oct 13, 2010, 11:40:20 AM10/13/10
to zfdeve...@googlegroups.com
http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.standard

provide custom route with defaults.  I don't think you really mean "redirect".

--Judah

Patrick McCanna

unread,
Oct 13, 2010, 2:20:49 PM10/13/10
to zfdeve...@googlegroups.com
I'm just getting started with Zend.  I didn't realize that .htaccess files could be considered "non-zend".  Can you articulate that better?  I'm curious as to what the preferred approach would be.  .htaccess files seem pretty vanilla to me.

I am using a "getting started with Zend" book and it starts off with a bunch of redirect kungfu which doesn't appear to work correctly.

Judah Anthony

unread,
Oct 13, 2010, 6:13:01 PM10/13/10
to zfdeve...@googlegroups.com
Don't hack the .htaccess. Use it to bootstrap Zend an then use routes for all your URLs. 

Sent from my iPhone

Randell

unread,
Oct 14, 2010, 1:16:45 AM10/14/10
to zfdeve...@googlegroups.com
On Thu, Oct 14, 2010 at 6:13 AM, Judah Anthony <judaht...@gmail.com> wrote:
Don't hack the .htaccess. Use it to bootstrap Zend an then use routes for all your URLs. 

@Patrick, Judah is correct. This is the more Zend-like way to do it.

Also, I've read in several forums that Zend Framework in Action is much better than Getting Started with Zend. 

Randell

unread,
Oct 14, 2010, 1:06:31 AM10/14/10
to zfdeve...@googlegroups.com
On Wed, Oct 13, 2010 at 11:40 PM, Judah Anthony <judaht...@gmail.com> wrote:
http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.standard

provide custom route with defaults.  I don't think you really mean "redirect".

Ah, I actually meant both routing and redirecting. Right now, I am able to create the route but haven't done the redirecting part.

Randell

unread,
Oct 15, 2010, 4:57:48 AM10/15/10
to zfdeve...@googlegroups.com
I was able to make /controllername/actionname/firstparametername/firstparametervalue accessible from /controllername/firstparametervalue, but the problem is that /controllername/actionname/firstparametername/firstparametervalue is still accessible. What I want to happen is make /controllername/firstparametervalue accessible. How to I make the original URL redirect silently to the new one?
Reply all
Reply to author
Forward
0 new messages