homepage Welcome to WebmasterWorld Guest from 54.198.135.17
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Remove: "OK, The document has moved here"
Remove 301 message and just make it forward.
BenjArriola




msg:3168346
 7:41 am on Nov 26, 2006 (gmt 0)

I have some 301 redirect pages that instead of just redirecting, it gives me this message:

OK
The document has moved here

Where the here is a hyperlink going to where the page supposed to go to.

It used to work on my server, but I just upgraded Apache, recompiled it with PHP5.

Here are some other details that may help...

301 redirects in my .htaccess file does not show this message.
301 redirects using PHP shows this. And I really want to use PHP in this case since the redirects are pulled from a database of old pages that no longer exist.

I am scanning my httpd.conf file looking for what I can change, but I can't seem to find anything yet.

 

BenjArriola




msg:3168355
 8:36 am on Nov 26, 2006 (gmt 0)

I found out this has nothing to do with Apache configurations. It is a PHP issue. Sorry for the wrong forum post. I didn't know this was a PHP problem and thought it was something I needed to configure in Apache.

But just to mention the solution to the problem:


<?php header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.domain.com/path/file.html");
exit();
?>

Of course the code above should come before everything else. And when I was using PHP4.3, it worked fine even if they were in some include() function. Now in PHP5, they need not only be the first thing in the file, but they cannot be in an include() function anymore if you want the forwarding to be automatic.

Note to Moderator: Sorry for the wrong forum post, could this be moved to the PHP forum?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved