Knowledge

HTTP 301

Source đź“ť

31: 809:: Many web browsers cache 301 redirects. This means that once a user's browser encounters a 301 redirect, subsequent requests to the original URL will be automatically directed to the new URL without contacting the server. 789:
recommend using a 301 redirect to change the URL of a page as it is shown in search engine results, providing that the URL will permanently change and is not due to be changed again any time soon.
870:: The new URL should always be provided in the "Location" field when a 301 redirect is sent. Omitting the Location header will confuse browsers and may result in unexpected behavior. 876:: While relative URLs might be accepted by some browsers, using absolute URLs in the Location header is the standard and ensures consistent behavior across all user agents. 914:: When redirecting from HTTP to HTTPS, ensure that all resources (images, scripts, stylesheets) on the page are also loaded over HTTPS to prevent mixed content warnings. 828:: Apache has mod_alias and mod_rewrite to handle 301 redirects. Using both often results in unpredictable behavior because modules do not respect other module rules. 310:
should be provided in the Location field, included with the response. The 301 redirect is considered a best practice for upgrading users from HTTP to
1063: 333:
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.
889:: Search engines typically transfer a majority of the link equity (or “link juice”) from the source URL to the target URL for 301 redirects. 797:
The HTTP 301 status code has several technical nuances that developers should be aware of when implementing and managing redirections:
908:: Using multiple 301 redirects in succession (A to B, then B to C) can lead to increased page load times and may dilute SEO value. 857:: Used when the result of a POST or another non-idempotent request method is a resource that should be retrieved using a GET. 1034: 306:. It is used for permanent redirecting, meaning that links or records returning this response should be updated. The new 330:
Unless the request method was HEAD, the entity should contain a small hypertext note with a hyperlink to the new URL(s).
851:: Like 302, but guarantees that the method and the body will not be changed when the redirected request is made. 277: 1006: 988: 220: 924: 895:: There might be a lag before search engines recognize the redirect and update their indexes accordingly. 215: 842: 122: 40: 929: 299: 165: 1023: 841:: Unlike a 301, a 302 status code indicates a temporary redirect. Search engines might not pass the 251: 246: 955: 241: 324:
If a client has link-editing capabilities, it should update all references to the Request URL.
236: 971: 782: 409:
To fix problems with non-existing files or directories using a distributed .htaccess file:
317: 8: 815:: Browsers may update bookmarks to reflect the new URL after encountering a 301 redirect. 270: 961: 45: 934: 442:
file to redirect a non-secure URL to a secure address without the leading "www":
156: 974: 291: 1057: 263: 141: 151: 146: 113: 108: 103: 98: 93: 83: 78: 73: 64: 1045: 131: 88: 660: 966: 439: 136: 199: 194: 189: 184: 179: 786: 590: 742: 311: 50: 30: 587: 55: 22: 616: 307: 507:
A custom directory redirect, using an index.html file:
633:"Location: https://example.com/newpage.html" 832: 327:
The response is cacheable unless indicated otherwise.
1024:
301 redirect for Apache .htaccess : mod_rewrite
1035:
SEO and HTTP status codes: A comprehensive analysis
1055: 947: 581: 271: 1046:301 Redirects Explained: How They Impact SEO 607:"https://example.com/newpage.html" 960:. IETF. p. 61. sec. 10.3.2. 278: 264: 965: 404: 1064:Hypertext Transfer Protocol status codes 953: 1056: 792: 954:Fielding; et al. (June 1999). 800: 13: 899: 861: 833:Comparison with other status codes 659:Here is one way to redirect using 14: 1075: 981: 776: 736: 399:https://www.example.org/index.asp 200:451 Unavailable for Legal Reasons 993:Bing Webmaster Help & How-to 880: 29: 498:^(.*)$ https://example.com/$ 1 208:Security access control methods 1039: 1028: 1017: 999: 819: 502: 1: 940: 957:10.3.2 301 Moved Permanently 221:Digest access authentication 7: 1011:Google Webmaster Tools Help 925:Hypertext Transfer Protocol 918: 741:Equivalently simple for an 615:Here is an example using a 582:Using programming languages 438:Here is an example using a 337: 216:Basic access authentication 10: 1080: 930:List of HTTP status codes 586:Here is an example using 477:%{HTTP_HOST}^www\.(.*)$ 462:%{HTTP_HOST}^www\.(.*)$ 300:HTTP response status code 16:HTTP response status code 747: 665: 621: 595: 509: 444: 411: 375: 344: 252:HTTP parameter pollution 229:Security vulnerabilities 247:HTTP response splitting 849:307 Temporary Redirect 481:^(.*)$ https://%1/$ 1 405:Using a .htaccess file 242:HTTP request smuggling 845:value to the new URL. 466:^(.*)$ http://%1/$ 1 304:301 Moved Permanently 237:HTTP header injection 175:301 Moved Permanently 166:Response status codes 912:Mixed Content Issues 887:Link Equity Transfer 725:"/new/url" 680:"/old/url" 533:"0; url=/" 868:Mandatory Inclusion 524:"refresh" 906:Multiple Redirects 874:Absolute URL Usage 813:Updating Bookmarks 765:'/new/URL' 320:2616 states that: 793:Technical details 390:Moved Permanently 373:Server response: 288: 287: 1071: 1048: 1043: 1037: 1032: 1026: 1021: 1015: 1014: 1003: 997: 996: 989:"Site Move Tool" 985: 979: 978: 969: 967:10.17487/RFC2616 951: 807:Caching Behavior 801:Browser handling 772: 769: 766: 763: 760: 757: 754: 751: 732: 729: 726: 723: 720: 717: 714: 711: 708: 705: 702: 699: 696: 693: 690: 687: 684: 681: 678: 675: 672: 669: 655: 652: 649: 646: 643: 640: 637: 634: 631: 628: 625: 611: 608: 605: 602: 599: 577: 574: 571: 568: 565: 561: 558: 555: 552: 549: 546: 543: 540: 537: 534: 531: 528: 525: 522: 519: 516: 513: 497: 494: 490: 487: 484: 480: 476: 473: 469: 465: 461: 458: 454: 451: 448: 433: 430: 427: 424: 421: 418: 415: 400: 397: 394: 391: 388: 385: 382: 379: 369: 366: 363: 360: 357: 354: 351: 348: 342:Client request: 280: 273: 266: 33: 19: 18: 1079: 1078: 1074: 1073: 1072: 1070: 1069: 1068: 1054: 1053: 1052: 1051: 1044: 1040: 1033: 1029: 1022: 1018: 1007:"301 redirects" 1005: 1004: 1000: 987: 986: 982: 952: 948: 943: 935:URL redirection 921: 902: 900:Common pitfalls 893:Indexing Delays 883: 864: 862:Location header 835: 822: 803: 795: 779: 774: 773: 770: 767: 764: 761: 758: 755: 752: 749: 745:configuration: 739: 734: 733: 730: 727: 724: 721: 718: 715: 712: 709: 706: 703: 700: 697: 694: 691: 688: 685: 682: 679: 676: 673: 670: 667: 657: 656: 653: 650: 647: 644: 641: 638: 635: 632: 629: 626: 623: 613: 612: 609: 606: 603: 600: 597: 584: 579: 578: 575: 572: 569: 566: 563: 559: 556: 553: 550: 547: 544: 541: 538: 535: 532: 529: 526: 523: 520: 517: 514: 511: 505: 500: 499: 495: 492: 488: 485: 482: 478: 474: 471: 467: 463: 459: 456: 452: 449: 446: 436: 435: 432:/not_found.html 431: 428: 425: 422: 419: 416: 413: 407: 402: 401: 398: 395: 392: 389: 386: 383: 380: 377: 371: 370: 368:www.example.org 367: 364: 361: 358: 355: 352: 349: 346: 340: 284: 157:X-Forwarded-For 65:Request methods 17: 12: 11: 5: 1077: 1067: 1066: 1050: 1049: 1038: 1027: 1016: 998: 980: 945: 944: 942: 939: 938: 937: 932: 927: 920: 917: 916: 915: 909: 901: 898: 897: 896: 890: 882: 879: 878: 877: 871: 863: 860: 859: 858: 852: 846: 834: 831: 830: 829: 821: 818: 817: 816: 810: 802: 799: 794: 791: 778: 777:Search engines 775: 748: 738: 737:Caching server 735: 666: 622: 596: 583: 580: 510: 504: 501: 491:%{SERVER_PORT} 445: 420:/calendar.html 412: 406: 403: 376: 345: 339: 336: 335: 334: 331: 328: 325: 292:World Wide Web 286: 285: 283: 282: 275: 268: 260: 257: 256: 255: 254: 249: 244: 239: 231: 230: 226: 225: 224: 223: 218: 210: 209: 205: 204: 203: 202: 197: 192: 187: 182: 177: 169: 168: 162: 161: 160: 159: 154: 149: 144: 139: 134: 126: 125: 119: 118: 117: 116: 111: 106: 101: 96: 91: 86: 81: 76: 68: 67: 61: 60: 59: 58: 53: 48: 43: 35: 34: 26: 25: 15: 9: 6: 4: 3: 2: 1076: 1065: 1062: 1061: 1059: 1047: 1042: 1036: 1031: 1025: 1020: 1012: 1008: 1002: 994: 990: 984: 976: 973: 968: 963: 959: 958: 950: 946: 936: 933: 931: 928: 926: 923: 922: 913: 910: 907: 904: 903: 894: 891: 888: 885: 884: 881:Impact on SEO 875: 872: 869: 866: 865: 856: 855:303 See Other 853: 850: 847: 844: 840: 837: 836: 827: 824: 823: 814: 811: 808: 805: 804: 798: 790: 788: 784: 746: 744: 664: 662: 620: 618: 594: 592: 589: 557:"/" 508: 483:RewriteEngine 447:RewriteEngine 443: 441: 410: 374: 343: 332: 329: 326: 323: 322: 321: 319: 315: 313: 309: 305: 301: 297: 293: 281: 276: 274: 269: 267: 262: 261: 259: 258: 253: 250: 248: 245: 243: 240: 238: 235: 234: 233: 232: 228: 227: 222: 219: 217: 214: 213: 212: 211: 207: 206: 201: 198: 196: 195:404 Not Found 193: 191: 190:403 Forbidden 188: 186: 185:303 See Other 183: 181: 178: 176: 173: 172: 171: 170: 167: 164: 163: 158: 155: 153: 150: 148: 145: 143: 140: 138: 135: 133: 130: 129: 128: 127: 124: 123:Header fields 121: 120: 115: 112: 110: 107: 105: 102: 100: 97: 95: 92: 90: 87: 85: 82: 80: 77: 75: 72: 71: 70: 69: 66: 63: 62: 57: 54: 52: 49: 47: 44: 42: 39: 38: 37: 36: 32: 28: 27: 24: 21: 20: 1041: 1030: 1019: 1010: 1001: 992: 983: 956: 949: 911: 905: 892: 886: 873: 867: 854: 848: 838: 825: 812: 806: 796: 780: 740: 658: 614: 585: 506: 437: 408: 372: 341: 316: 303: 295: 289: 174: 147:HTTP referer 820:Server side 503:Static HTML 496:RewriteRule 489:RewriteCond 479:RewriteRule 475:RewriteCond 468:RewriteCond 464:RewriteRule 460:RewriteCond 453:RewriteCond 46:Compression 41:Persistence 941:References 661:Express.js 619:redirect: 518:http-equiv 423:/Calendar/ 350:/index.php 839:302 Found 570:></ 440:.htaccess 180:302 Found 1058:Category 919:See also 753:/old/URL 750:location 713:redirect 624:<?php 601:redirect 545:>< 470:%{HTTPS} 455:%{HTTPS} 426:Redirect 414:Redirect 393:Location 338:Examples 296:HTTP 301 142:Location 527:content 298:is the 290:On the 109:CONNECT 74:OPTIONS 826:Apache 787:Google 759:return 627:header 591:CGI.pm 132:Cookie 99:DELETE 781:Both 743:nginx 701:=> 598:print 564:</ 536:/> 312:HTTPS 114:PATCH 104:TRACE 51:HTTPS 975:2616 785:and 783:Bing 651:exit 639:true 588:Perl 576:> 562:Home 560:> 551:href 539:< 515:meta 512:< 378:HTTP 362:Host 353:HTTP 302:for 137:ETag 89:POST 84:HEAD 56:QUIC 23:HTTP 972:RFC 962:doi 843:SEO 762:301 731:}); 719:301 707:res 695:res 689:req 674:all 668:app 645:301 617:PHP 457:off 429:301 417:301 387:301 384:1.1 359:1.1 347:GET 318:RFC 308:URL 152:DNT 94:PUT 79:GET 1060:: 1009:. 991:. 970:. 728:); 663:: 648:); 610:); 593:: 493:80 486:On 472:on 450:On 434:/ 314:. 294:, 1013:. 995:. 977:. 964:: 771:} 768:; 756:{ 722:, 716:( 710:. 704:{ 698:) 692:, 686:( 683:, 677:( 671:. 654:; 642:, 636:, 630:( 604:( 573:p 567:a 554:= 548:a 542:p 530:= 521:= 396:: 381:/ 365:: 356:/ 279:e 272:t 265:v

Index

HTTP

Persistence
Compression
HTTPS
QUIC
Request methods
OPTIONS
GET
HEAD
POST
PUT
DELETE
TRACE
CONNECT
PATCH
Header fields
Cookie
ETag
Location
HTTP referer
DNT
X-Forwarded-For
Response status codes
301 Moved Permanently
302 Found
303 See Other
403 Forbidden
404 Not Found
451 Unavailable for Legal Reasons

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑