Welcome Guest, Not a member yet? Register   Sign In
redirection failure

after moving my local CI app up to a testing server, i've run into a bunch of problems, my latest is redirection not working.

took testing a step further and created some test functions:

function redirect(){
function redr(){
header("Location: http://google.com");

both of these work locally, but fail when i move up to testing machine...

i should mention that my local install is on an IIS machine and testing is an apach machine, app structure is a little different too, test machine has app in subdirectory, but config has been updated, and i don't think would affect the header location call...

i'll definately be investing in an apache development machine too, too many problems going from IIS to apache.

any ideas here?


By default the redirect function uses a header to redirect. As this doesn't seem to be working for you (sometimes has issues on IIS) there's another redirect method called 'location'.

You can use it like this

redirect('/controller/function', 'location');

Thanks, it does actally work on my local install on IIS, I also tried several variations of the redirect function, including refresh and location params. Any other ideas?

Sorry, I read it as the other way around for some reason. That's very stange as IIS can have problems with redirect but apache is usually fine, sounds like it may be a server setup issue, time to hack up your apache conf!

i'm still having no luck resolving my issue with redirection, both redirect and header location do nothing on my stage server. i ran another test though, created a file in the site's root and simply added this:

header("Location: http://www.google.com/");

when i hit that page i am redirected. it seems like whenever i call a redirect inside a function though, it fails on my stage server. but my local IIS server handles it just fine.

so i went and did a little compare between phpinfo() output from both servers, ran across this setting:


on my IIS: output_buffering = 1
in stage Apache: output_buffering = no value

i'll have to look into these a little further. anyone else have any ideas or run across anything like this in their app?

yup, it was a problem with output buffering... added a htaccess file with
php_value output_buffering 1

redirects working again

Hi allibubba,

I am facing the similar kind of problem. I tried the htaccess trick but its not working on the server I am.

php_value output_buffering 1

The above is the content in my .htaccess file that I have placed at the site root. But it shows 500 server error message soon after refresh Sad

Any suggestions?

have you tried a .htaccess file with just this:

php_value output_buffering 1

what's your output for phpinfo(), should be able to see output_buffering value

hi the issue is resolved. for some weird reason 3 special characters were being added to my files every time i save it. To normal editor those characters are not visible only visible if edited the file in DOS mode :-S or web editor.

if any of you faced such issues let me know who you solved it. I use inType for general editing of code and it was working fine here till this started to happen.



Theme © iAndrew 2016 - Forum software by © MyBB