Post Error Code 301 Shows
Contents |
Status codes 301 Moved Permanently 302 Found 303 See Other 403 Forbidden 404 Not Found 301 moved permanently nginx 451 Unavailable For Legal Reasons v t e The HTTP 301 moved permanently curl response status code 301 Moved Permanently is used for permanent URL redirection, meaning current links http 301 vs 302 or records using the URL that the response is received for should be updated. The new URL should be provided in the Location field included http status code 400 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 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
Http Status Codes Cheat Sheet
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 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/
referer DNT X-Forwarded-For Status codes 301 Moved Permanently 302 Found 303 See Other 403 Forbidden 404 Not Found 451 Unavailable
Http Code 302
For Legal Reasons v t e This is a list http response example of Hypertext Transfer Protocol (HTTP) response status codes. It includes codes from IETF internet standards, other 302 redirect IETF RFCs, other specifications, and some additional commonly used codes. The first digit of the status code specifies one of five classes of response; an HTTP client https://en.wikipedia.org/wiki/HTTP_301 must recognise these five classes at a minimum. The phrases used are the standard wordings, but any human-readable alternative can be provided. Unless otherwise stated, the status code is part of the HTTP/1.1 standard (RFC 7231).[1] The Internet Assigned Numbers Authority (IANA) maintains the official registry of HTTP status codes.[2] Microsoft IIS sometimes uses https://en.wikipedia.org/wiki/List_of_HTTP_status_codes additional decimal sub-codes to provide more specific information,[3] but not all of those are here (note that these sub-codes only appear in the response payload and in documentation; not in the place of an actual HTTP status code). Contents 1 1xx Informational 2 2xx Success 3 3xx Redirection 4 4xx Client Error 5 5xx Server Error 6 Unofficial codes 6.1 Internet Information Services 6.2 nginx 6.3 Cloudflare 7 See also 8 Notes 9 References 10 External links 1xx Informational[edit] Request received, continuing process. This class of status code indicates 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[note 1] send a 1xx response to an HTTP/1.0 client except under experimental conditions.[4] 100 Continue The server has received the request headers and the client should proceed to send the request body (in the case of a request for which
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn http://stackoverflow.com/questions/30352566/lost-data-because-of-301-error-post more about hiring developers or posting ads with us Stack Overflow Questions 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. 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, 301 moved 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 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 -ii- May 20 '15 at 14:27 voted to close as unclear –Fred -ii- May 20 '15 at 14:30 I added things that you asked, sorry for this... But the </form> is here, and there is no problem in addSwitchPort() –Pierre Belin May 20 '15 at 14:37 HTTP 301 is a redirect, you are losing your data because the browser is being forwarded to a new URL. Check your server config –danjam May 20 '15 at 14:38 besides an answer already given below, make sure that your file's case is indeed addSwitchPort.php and not addswitchport.php all in lowercase or other cas