anchors
From: Ben Wilson (pleaseno_at_spam.com)
Date: 04/29/04
- Next message: Felix Natter: "Re: replacement for ftp_close"
- Previous message: Chris Allen: "Re: Session_Start() Doesn't Work"
- Next in thread: Eric Bohlman: "Re: anchors"
- Reply: Eric Bohlman: "Re: anchors"
- Reply: John Dunlop: "Re: anchors"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 29 Apr 2004 15:02:48 +0200
To anyone who can help me, you have my thanks in advance.
I am implementing a "301 Moved Permanently" redirect in my website due to a
change of our domain names. Unfortunately, I am having a problem with
reconstructing the target "Location" http header because I'm missing just
one thing.
My links look as follows:
http://www.oldurl.com/beanie.php#three?register=false&demt=43
This I need to change to the following:
http://www.newurl.org/beanie.php#three?register=false&demt=43
As you can see, it's no BIG deal. All I need to change is the start and all
the rest can stay the same. So I need to create the new URL as a string so I
can call the following:
header("HTTP/1.1 301 Moved Permanently");
header($locationstring);
exit;
That's all.
First, I recreate the "server name" with the following two lines of code:
$oldurl = $_SERVER['HTTP_HOST'];
$newurl = str_replace("oldurl.com", "newurl.org", $oldurl);
Next, I can recreate the file name ("beanie.php") with the following line of
code:
$locationstring = ("Location: http://".$newurl.$_SERVER['PHP_SELF']);
Now I've got http://www.newurl.org/beanie.php.
The two GET vars "register" and "demt" I can access with
$registercode = $HTTP_GET_VARS["register"];
$articlecode = $HTTP_GET_VARS["demt"];
But how do I get the anchor!?!?!?!? How do I know if there was one and if so
what it was (the #three bit above).
Many thanks,
Ben.
- Next message: Felix Natter: "Re: replacement for ftp_close"
- Previous message: Chris Allen: "Re: Session_Start() Doesn't Work"
- Next in thread: Eric Bohlman: "Re: anchors"
- Reply: Eric Bohlman: "Re: anchors"
- Reply: John Dunlop: "Re: anchors"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|