Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6842157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:03:54+00:00 2026-05-27T00:03:54+00:00

On http://www.hesa.ac.uk , we are using a custom 404 handling script to redirect users

  • 0

On http://www.hesa.ac.uk, we are using a custom 404 handling script to redirect users from, for exmaple, http://www.hesa.ac.uk/press to the actual URL, which is an ugly CMS one: http://www.hesa.ac.uk/index.php?option=com_content&task=category&sectionid=1&id=1&Itemid=161

We’re running fast-cgi.

A 301 header is sent, then a location header.

It works fine for 99% of our users but some of them are reporting 5 to 6 second loading times. This is, we think, due to a bit of stray content which is turning up in the redirection:

<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a HREF="http://www.hesa.ac.uk/index.php?option=com_content&amp;task=category&amp;sectionid=1&amp;id=1&amp;Itemid=161">here</a></body>

This isn’t output anywhere in the code that we can see. Here’s the method which actually does the redirection:

    /**
 * Do the actual redirection to the win URL
 *
 */
function doRedirection() {


        //start output buffering to trap any content that is output by default by the headers
        @ob_start();

        //permanently moved header
        //header( 'HTTP/1.1 301 Moved Permanently' );

        //fast-cgi, so use this:        
        header('Status: 301 Moved Permanently', true);              

        @ob_end_clean(); // clear output buffer

        //location header
        header( "Location: ". $this->winUrl );  

        @ob_end_clean(); // clear output buffer

        die();



}

I cannot seem to find any resource which indicates how to stop this extra bit of content being output. I have tried various variations on the method above to do the redirection.

Has anyone had a similar problem? Does anyone have any ideas?

Cheers,

G

EDIT: we’ve become aware that this is expected behaviour for IIs7, but IIS6 never used to do it with the same code, and whether it’s expected or not, our users are complaining and this seems to be the issue.

EDIT 2: it seems that the only workable solution is to abandon this approach and instead move to IIS7’s url rewriting functionality, which entails writing a C# class which clones the functionality of the PHP class then plugging that into IIS.

EDIT 3: HOWEVER, setting a content-length: 0 header might possibly help. Not tested yet though.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:03:54+00:00Added an answer on May 27, 2026 at 12:03 am

    Turns out the problem was actually the use of the built-in PHP function getHostByAddr() within the redirection code. Client hosts which do not have their DNS records set up properly experience a 5 to 6 second delay from getHostByAddr() (under IIS7, we never had this issues with IIS6). If you find an alternative function and swap it out, the problem disppears.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://www.validome.org/xml/validate/?lang=en&viewSourceCode=1&url=http://45143.com/finance-feed/abc.xml&onlyWellFormed=1 check the url above for validator results. Line 171 in the XSD is
http://www.stockmapper.com/NDXtrac.html Would be possible to develop the above chart using SVG and Javascript or
http://www.switchonthecode.com/tutorials/getting-started-with-opengl-es-for-the-iphone From the above link they created tutorial by No Nib File. But i
http://www.example.com/http://www.test.com I have tried many different methods using .htaccess with no luck. I need
http://www.kampyle.com/ in this url when you scroll one picture always moves. I want to
_http://www.mscui.net/PatientJourneyDemonstrator/PrimaryCare.htm I want to create/design the similar to above site/url using silverlight. For this
http://www.google.co.uk/search?q=mark+zuckerberg+crunchbase Guys, check out that search, in particular the first result's url. Crunchbase.com >
http://www.example.com?foo What's the term for the foo part of the URL?
http://www.jacksasylum.eu/ContentFlow/docu.php this is the link of jquery plugin which i am using in asp.net
http://www.dennys.com I'm wondering how the top navigation was programmed, From the source code I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.