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:
This I need to change to the following:
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($locatio nstring);
exit;
That's all.
First, I recreate the "server name" with the following two lines of code:
$oldurl = $_SERVER['HTTP_HOST'];
$newurl = str_replace("ol durl.com", "newurl.org ", $oldurl);
Next, I can recreate the file name ("beanie.php ") with the following line of
code:
$locationstring = ("Location: http://".$newurl.$_SER VER['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.
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:
This I need to change to the following:
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($locatio nstring);
exit;
That's all.
First, I recreate the "server name" with the following two lines of code:
$oldurl = $_SERVER['HTTP_HOST'];
$newurl = str_replace("ol durl.com", "newurl.org ", $oldurl);
Next, I can recreate the file name ("beanie.php ") with the following line of
code:
$locationstring = ("Location: http://".$newurl.$_SER VER['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.
Comment