anchors

From: Ben Wilson (pleaseno_at_spam.com)
Date: 04/29/04


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.



Relevant Pages

  • Capital Ones website inadvertently assists phishing
    ... Capital One's website has an unchecked redirect. ... > regularly screen the Capital One Bank system for unusual activity. ... To protect the security of your account, ...
    (Bugtraq)
  • Re: Network/Routing Question
    ... Since I am unsure of a way to install OWA to another website, ... I've killed OWA and SBS doing so. ... If your *default* website use remote.domainname.com, and you are thinking of adding a header to the default website then no, this cannot be done. ... And if you create a new site and add a header then you still have to make the default site accessible for the redirect. ...
    (microsoft.public.windows.server.sbs)
  • Re: redirect URL
    ... I had a somewhat similar problem but my websites were on the same server. ... open the properties screen for that website and click the Home Directory ... "Redirect to:" where you fill in the domain part of the URL that you want to ... $V is a redirect variable and I believe the help in IIS 5 is not working ...
    (microsoft.public.sharepoint.portalserver)
  • RE: Using redirect for a folder/directory
    ... your question is about how to redirect both the ... If I've misunderstood anything, ... you need to redirect the website by following steps: ... Then you need to create a virtual directory in your new website named ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Using redirect for a folder/directory
    ... your question is about how to redirect both the ... If I've misunderstood anything, ... you need to redirect the website by following steps: ... Then you need to create a virtual directory in your new website named ...
    (microsoft.public.dotnet.framework.aspnet)