close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Server redirect not working on live server

Thread began 7/11/2016 7:49 am by Jason | Last modified 7/13/2016 9:20 am by Ray Borduin | 778 views | 4 replies |

Jason

Server redirect not working on live server

I have a redirect that works fine on my testing server, but not on my live server.

php:
<?php

if($_SERVER["REQUEST_METHOD"] == "POST"){
    
$WA_Redirect_URL "attendance.php";
    
$WA_Redirect_KeepQS true;
    if (
$WA_Redirect_URL != "")  {
     if (
$WA_Redirect_KeepQS && $WA_Redirect_URL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "") {
        
$WA_Redirect_URL .= ((strpos($WA_Redirect_URL'?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
     }
     
header("Location: ".$WA_Redirect_URL);
    }
//    echo"here it is";
//    die;
}
?>




I've verified that the live server is reaching that code using an echo/die statement, but for some reason it's still not redirecting. The problem page is attached.

Sign in to reply to this post

Christopher WestCommunity Expert

I without looking at the code more closely, I don't suppose you checked if the file on the server is named as "Attendance.php" - I am wondering if its a case sensitive issue? Chris

Sign in to reply to this post

Jason

Nope, it's not a case sensitive issue. Upon investigating further today, it's happening on every page that uses the server redirect code and a specific theme. I've got multiple themes, and the problem only occurs on pages that use this one. The theme is attached to this message.

Attached Files
alf_cms_blank.dwt.php
Sign in to reply to this post

Jason ByrnesWebAssist

Looks like white space between php tags is causing the dreaded Headers Already Sent error which in turn is causing the redirect to fail.

There are multiple code blocks on your page that are indented, for example the code block at lines 87-92:

<?php
$smallgroups = new WA_MySQLi_RS("smallgroups",$local_i,0);
$smallgroups->setQuery("SELECT sg_smallgroup.* FROM sg_smallgroup WHERE sg_smallgroup.leader = ?");
$smallgroups->bindParam("i", "".(isset($user_id)?$user_id:"") ."", "-1"); //WAQB_Param1
$smallgroups->execute();
?>



(the blank space at the start of the <php tag is not showing here, but view the original page in Dreamweaver and you will see it)

the tab that is in front of the opening php tag is writing blank space to the page, this before the header() function will cause the headers already sent error when it tries to do the redirect.

there are a few other parts of the page that have the same indenting of php code blocks.

for more details on the headers already sent error, see the following post:
http://www.webassist.com/forums/posts.php?id=19285

Sign in to reply to this post

Jason

White space was the issue. Thanks Jason!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...