On Nov 11, 10:27 pm, domnuprofesor <domnuprofe...@gmail.com> wrote:
> Hi there!
>
> I'm switching a website to symfony that has over 180k pages indexed by
> google.
> Each page need quite a bit of server logic to redirect to the new
> pages.
> My problem is that I'm not sure I'm doing things write (and fast) in
> symfony.
> Would you please let me know if this is ok?
>
> this is how I do it (symfony 1.2.9)
>
> sfContext::getInstance()->getConfiguration()->loadHelpers(array
> ('Url'));
> $this->getResponse()->setStatusCode('301', 'Moved Permanently');
>
> ...logic: find the new route based on some parameters...
>
> $this->getResponse()->setHttpheader('Location', url_for('@new_route');
>
> return sfView::NONE;
>
> I see that in the firebug reports the header 301, so I think this is
> ok.
> I look forward for your responses.
>
> Thank you!

I think you will achieve pretty much the same thing, without the need
to access the context directly, or load the url helper implicitly.
Assuming you are working within an action:

$this->redirect("@new_route", 301);

Nothing is executed after this, so there is no need to return
sfView::none() afterwards.

--

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


Reply via email to