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

[eluser]allibubba[/eluser]
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:

Code:
function redirect(){
redirect('controller/function');
return;
}
function redr(){
header("Location: http://google.com");
exit;
}


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?
#2

[eluser]Cro_Crx[/eluser]
Hey

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

Code:
redirect('/controller/function', 'location');
#3

[eluser]allibubba[/eluser]
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?
#4

[eluser]Cro_Crx[/eluser]
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!
#5

[eluser]allibubba[/eluser]
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:

Code:
<?
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:

output_buffering

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?
#6

[eluser]allibubba[/eluser]
yup, it was a problem with output buffering... added a htaccess file with
Code:
php_value output_buffering 1

redirects working again
#7

[eluser]thephpx[/eluser]
Hi allibubba,

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

.htaccess
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?
#8

[eluser]allibubba[/eluser]
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
#9

[eluser]thephpx[/eluser]
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.

thanks

thephpx




Theme © iAndrew 2016 - Forum software by © MyBB