how to manange redirect 301 locally

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

how to manange redirect 301 locally

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Disable the php code that does the redirection.
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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. :)
User avatar
tasteslikepurple
Forum Commoner
Posts: 46
Joined: Thu Jan 26, 2006 3:38 am
Location: Bath, UK

Post 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).
Post Reply