How to redirect after echoed

I m having trouble with redirection in CController. I have echoed things before calling CController::redirect(). It doesnt work, I know. Because the header has been modified before. So how can I redirect if something has been echoed before?

use javascript

Why would you echo things to the output if you want to redirect? Users never would see this output so just don’t do it.

Yes! that s what i m doing. It s bad, but it means in my circumstance. Cannot find any way to do this. I m thinking of clear the output, but it s not helpful. I m just a newbie :). Any one can help, please?

What do you echo/output? Maybe we can find better solution. So you may post your code here.

That’s why in MVC all output should usually be done in a view file. You should try to fix this first.

There are only a few special situations where you want to echo from a controller (e.g. echo a json_encoded strings or for debugging).

Thank you! I think I will find a better solution rather than doing like this.

Javascript code is simple:

location.href = "http://...";

But as mentioned above, usually it’s not a good solution.