Post 301 Error Code
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the 301 moved permanently nginx workings and policies of this site About Us Learn more about
301 Moved Permanently Curl
Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
Http 301 Vs 302
Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other.
302 Status Code
Join them; it only takes a minute: Sign up Lost data because of 301 error (POST) up vote -1 down vote favorite I've a 301 error after doing my POST Form... When I submit my form, I lose all my data and I don't know why. I search on the net but I don't understand anything because my english 302 redirect is too bad to do it... My HTML code addSwitchPort.html :
My PHP code addSwitchPort.php : setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $switchID = getIDSwitch($switchName); try { $sql = 'INSERT INTO switchport (switchID) VALUES ("'.$switchID.'"")'; $conn->exec($sql); echo 'SUCCESS'; } catch(PDOException $e) { echo $sql . "" . $e->getMessage(); } } Do you know why the echo is empty ? There is no way because this is the right location ! php html post share|improve this question edited May 20 '15 at 14:36 asked May 20 '15 at 14:25 Pierre Belin 297 you tagged this as ajax, why? Plus, if that's your actual code, you've a missing </form> tag. and what does addSwitchPort() do? show full code please –Fred -
Status codes 301 Moved Permanently 302 Found 303 See Other 403 Forbidden 404 Not Found 451 Unavailable For Legal Reasons v t e The HTTP response status http code 304 code 301 Moved Permanently is used for permanent URL redirection, meaning current links http 403 or records using the URL that the response is received for should be updated. The new URL should http 500 be provided in the Location field included with the response. The 301 redirect is considered a best practice for upgrading users from HTTP to HTTPS.[1] RFC 2616 states that: If a http://stackoverflow.com/questions/30352566/lost-data-because-of-301-error-post client has link-editing capabilities, it should update all references to the Request URL. The response is cachable.[2] Unless the request method was HEAD, the entity should contain a small hypertext note with a hyperlink to the new URL(s). If the 301 status code is received in response to a request of any type other than GET or HEAD, the client must https://en.wikipedia.org/wiki/HTTP_301 ask the user before redirecting. Contents 1 Example 1.1 Search engines 2 See also 3 References Example[edit] Client request: GET /index.php HTTP/1.1 Host: www.example.org Server response: HTTP/1.1 301 Moved Permanently Location: http://www.example.org/index.asp Here is an example using an htaccess file to redirect to a non www with an SSL attached to the domain. RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteCond %{HTTPS} on RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://example.com/$1 [R,L] Here is an example using a PHP redirect. Equivalently simple for an nginx configuration. location /old/url/ { return 301 /new/url; } Search engines[edit] Both Bing and Google recommend using a 301 redirect to change the URL of a page as it is shown in search engine results.[3][4] See also[edit] Hypertext Transfer Protocol List of HTTP status codes References[edit] ^ "Secure your site with HTTPS". support.google.com. Google. Retrieved 6 February 2016. ^ How long do browsers cache HTTP 301s? - https://stackoverflow.com/questions/9130422/how-long-do-browsers-cache-http-301s ^ Site Move Tool - Bing Webmaster H
consisting only of the Status-Line and optional headers, and is terminated by an empty line. There are no required headers for this class of status http://www.restapitutorial.com/httpstatuscodes.html code. Since HTTP/1.0 did not define any 1xx status codes, servers MUST NOT https://www.addedbytes.com/articles/for-beginners/http-status-codes/ send a 1xx response to an HTTP/1.0 client except under experimental conditions. A client MUST be prepared to accept one or more 1xx status responses prior to a regular response, even if the client does not expect a 100 (Continue) status message. Unexpected 1xx status responses MAY be ignored by a user agent. 301 moved Proxies MUST forward 1xx responses, unless the connection between the proxy and its client has been closed, or unless the proxy itself requested the generation of the 1xx response. (For example, if a proxy adds a "Expect: 100-continue" field when it forwards a request, then it need not forward the corresponding 100 (Continue) response(s).) Wikipedia Request received, continuing process. This class of status code indicates 301 moved permanently a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. Since HTTP/1.0 did not define any 1xx status codes, servers must not send a 1xx response to an HTTP/1.0 client except under experimental conditions. 100 Continue The client SHOULD continue with its request. This interim response is used to inform the client that the initial part of the request has been received and has not yet been rejected by the server. The client SHOULD continue by sending the remainder of the request or, if the request has already been completed, ignore this response. The server MUST send a final response after the request has been completed. See section 8.2.3 for detailed discussion of the use and handling of this status code. Wikipedia This means that the server has received the request headers, and that the client should proceed to send the request body (in the case of a request for which a body needs to be sent; for example, a POST request). If the request body is large, sending it to a server when a request has already been rejected based upon inappropriate headers is inefficient. To
Articles Code Recommended Most Popular HTTP Status Codes for Beginners All valid HTTP 1.1 Status Codes simply explained. HTTP, Hypertext Transfer Protocol, is the method by which clients (i.e. you) and servers communicate. When someone clicks a link, types in a URL or submits out a form, their browser sends a request to a server for information. It might be asking for a page, or sending data, but either way, that is called an HTTP Request. When a server receives that request, it sends back an HTTP Response, with information for the client. Usually, this is invisible, though I'm sure you've seen one of the very common Response codes - 404, indicating a page was not found. There are a fair few more status codes sent by servers, and the following is a list of the current ones in HTTP 1.1, along with an explanation of their meanings. A more technical breakdown of HTTP 1.1 status codes and their meanings is available at http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html. There are several versions of HTTP, but currently HTTP 1.1 is the most widely used. Informational 100 - ContinueA status code of 100 indicates that (usually the first) part of a request has been received without any problems, and that the rest of the request should now be sent.101 - Switching ProtocolsHTTP 1.1 is just one type of protocol for transferring data on the web, and a status code of 101 indicates that the server is changing to the protocol it defines in the "Upgrade" header it returns to the client. For example, when requesting a page, a browser might receive a statis code of 101, followed by an "Upgrade" header showing that the server is changing to a different version of HTTP. Successful 200 - OKThe 200 status code is by far the most common returned. It means, simply, that the request was received and understood and is being processed.201 - CreatedA 201 status code indicates that a request was successful and as a result, a resource has been created (for example a new page).202 - AcceptedThe status code 202 indicates that server has received and understood the request, and that it has been accepted for processing, although it may not be processed immediately.203 - Non-Authoritative InformationA 203 status code means that the request was received and understood, and that information sent back about the response is from a third party, rather than the original server. This is virtually identical in meaning to a 200 status code.204 - No ContentThe 204 status code means that the request was received and understood, but that there is no need to send any