Page 1 of 1

how to manange redirect 301 locally

Posted: Wed Mar 22, 2006 7:37 am
by jasongr
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

Posted: Wed Mar 22, 2006 8:45 am
by feyd
Disable the php code that does the redirection.

Posted: Wed Mar 22, 2006 8:51 am
by jasongr
I guess my question wasn't clear enough

I performed the redirect already.
When I go to http://localhost/test.php?p=1, I don't pass through the code that performs
the redirect (I actually put it in comment)

but for some reason I get redirected to http://localhost/test.php
It is as if the browser/web server remember that page http://localhost/test.php?p=1
was permanently redirected to http://localhost/test.php

all I want now is to be able to go to http://localhost/test.php?p=1 without being automatically
redirected to http://localhost/test.php by the browser/apache

any way to do it?

Posted: Wed Mar 22, 2006 9:34 am
by feyd
Sounds like a caching problem. Tell your browser to dump it's cache and try again or force the browser to load the page anew by adding some random garbage to the url..

Posted: Wed Mar 22, 2006 9:54 am
by jasongr
thanks, that indeed solved the problem
It was cached in the browser.
I thought that it was apache that was responsible, but I was wrong

Posted: Wed Mar 22, 2006 10:01 am
by feyd
to avoid this problem in the future if you're using IE, tell it to always get a new page "every time" in its options. It will slow down pages a bit, but it's better than looking at old cache. :)

Posted: Wed Mar 22, 2006 11:58 am
by tasteslikepurple
jasongr wrote:thanks, that indeed solved the problem
It was cached in the browser.
I thought that it was apache that was responsible, but I was wrong
it was cahced because 301 means that the document has permanently moved, therefore there is no point in even going back to the original URI, so the browser remembers that it has to go to the new one (if that makes sense)

i.e. you said to the browser that http://localhost/test.php?p=1 no longer exists and that it must go to http://localhost/test.php instead, so it just saves time by caching the 301 redirects. you could try a 302 redirect instead for developement work :) (302 means temporarily moved).