Final Fantasy Ringtones - Song Lyrics - The eBay Song - Credit Cards - eHarmony Coupon

PDA

View Full Version : how to manange redirect 301 locally


jasongr
Mar 22nd 2006, 6:40 am
Hello people

I am using Apache 2.0.55 Web server as a service on top of Windows machine
I am using PHP as a server side script

During debugging my application locally on 'localhost'
I performed some 301 redirects on some pages.

Now I cannot make Apache forget about these redirects
For example
I used PHP to peform 301 redirect from
http://localhost/test.php?p=1
to
http://localhost/test.php

I now regret this, but everytime I go to http://localhost/test.php?p=1, I am being taken to
http://localhost/test.php

Since this was done locally, I hope there is a way to tell Apache to forget about this changes
Am I right?

Any help would be appreciated
regards

Jean-Luc
Mar 22nd 2006, 6:49 am
Hi,

What did you do to perform these 301 redirects ? DId you do it within the PHP programs or did you use .htaccess ?

Jean-Luc

jasongr
Mar 22nd 2006, 6:52 am
I used the following syntax to perform the 301 redirect:

header("HTTP/1.1 301 Moved Permanently");
header("Location: http://localhost/test.php");
exit;

I got to that page using the URL:
http://localhost/test.php?p=1
and that caused it to be redirected to http://localhost/test.php

Canada Web Design
Mar 22nd 2006, 7:00 am
take out that 301 redirect you dont need it, instead use a modrewrite within you .htacess to accomplish what you need

jasongr
Mar 22nd 2006, 7:03 am
take out that 301 redirect you dont need it, instead use a modrewrite within you .htacess to accomplish what you need
There are 2 problems with that solution:
1) It doesn't solve my problem. I still want to be able to go to http://localhost/test.php?p=1 without losing my parameter
2) I cannot let Apache do this redirect as it should only happen upon very specific conditions that I can only verify in PHP

any other suggestions?

mad4
Mar 22nd 2006, 7:11 am
if($p==""){
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://localhost/test.php");
exit;
}

jasongr
Mar 22nd 2006, 7:15 am
Maybe I am not being clear.
I don't want to know whether I need to redirect or not
I don't want to know how I can perform redirect in other means, or how can I use logic to decide whether to perform redirect

I already performed the permanent (301) redirect.
It is done already - Take it as a fact

I want to revert what I did and to cause apache to forget that it was ever done

Jean-Luc
Mar 22nd 2006, 7:17 am
I want to revert what I did and to cause apache to forget that it was ever doneThis does not make sense to me. Apache will not remember what you put in a PHP program yesterday, if you change it today.

I am still not understanding what you try to achieve.:confused:

Jean-Luc

mad4
Mar 22nd 2006, 7:18 am
Just delete the redirect code from the page and it will stop working.

Maybe you need to refresh the page to get rid of the cached copyas well.