Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rediredt (Rewrite) not working

Status
Not open for further replies.

Ztruker

Technical User
Nov 26, 2010
13
US
I can't get a redirect using the PHP Header command to work on Windows 7 Pro X64 with Apache 2.2 and PHP 5.3.3.

Code worked fine with the old version of Apache and PHP but I can't figure out why it is not working now. I'm not getting a PHP error and the PHP header command does get processed but no redirection occurs (I verified this by writing to a log file after the header command was issued).

Thinking it must be the new Apache (I was using Apache/1.3.27 (Win32) PHP/4.3.9)

I changed AllowOverride from None to All
I added AccessFileName dot.htaccess (Windows does not like .htaccess) and put RewriteEngine on in it.

Any help greatly appreciated.

Rich K.
 
This looks to be a PHP problem (I think) As I was able to set up a simple test:

test.html:
<?php
ob_start();
?>
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php
header("Location: ob_end_flush();
exit;
?>
</body>
</html>

ReDirWorks.html:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
"Redirect worked!";
</body>
</html>

When I enter test.html in the URL, I get successfully redirected to ReDirWorks.html, so it's not an Apache problem. I'll post in one of the PHP forums and see if I can get some help there.


Rich K.
 
Found it. The PHP flush() command now flushes the buffered data from ob_start which it did not do in the previous version of PHP.

Rich K.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top