Jump to content

Request_URI


Floydascc81

Recommended Posts

I have the below php in my 404.php in wordpress. Recently we moved our main site url to wordpress from IIS. Company name is important.

I want to treat any url that contains \prtaxsvc to not change from POST to GET as I need to run a WCF .svc file on the old server which runs IIS ( cant run a .svc on wordpress hosted site ) 

any clue on how to make this work. I think I need to make \prtaxsvc report as 308 or 307 and leave other old calls as 301. Right now it fails to send .svc to old server..

thanks

get_header();
?>
<?php
header("HTTP/1.1 301 Moved Permanently");

header("Location: http://www.mysite.com{$_SERVER['REQUEST_URI']}"); 

exit();

?>

Link to comment
Share on other sites

There is no mechanism in HTTP to tell a client that it should submit POST requests to a new URL.

The industry handles this in a fairly standard way: deprecate the old endpoint before taking it down. Continue supporting it for some period of time and give a warning to consumers that it will move.

Link to comment
Share on other sites

301 Moved Permanently: The resource has been permanently moved and request method conversion from POST to GET is allowed.

307 Temporary Redirect: The resource has been temporarily moved and request method conversion from POST to GET is forbidden.

302 Found: The resource has been temporarily moved and request method conversion from POST to GET is allowed.

Link to comment
Share on other sites

Are you using someone's blog as your reference?

https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.8

Quote

If the 307 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.

 

Link to comment
Share on other sites

So do what I said: deprecate the old endpoint, but keep it working until the DLL can be updated. Ideally you would keep everything working instead of redirecting because there are other nuances to consider, but at a minimum keep the non-GET/HEADs up.

If it's something distributed to customers then you'll have to keep this going for however long you support your software. If it's something internal then, you know, update the DLL.

Link to comment
Share on other sites

  • 2 weeks later...

POSTs don't follow the same rule because POSTs don't follow the same rule. It's written into the standards, and with the comment that the user might not want the site to redirect their data somewhere else.

And I didn't say to give up. I said that you cannot automatically redirect like this so you have to do something else - such as support the old POST endpoints until you can be reasonably sure that all consumers have been updated to go to the new site.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.