Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Linux System Getting Started Learning: Disable HTTP forwarding wget in     - How do I use Linux development environment (Linux)

- Ubuntu install snmp packets Unlinked OID in IPATM-IPMC-MIB: marsMIB (Linux)

- To generate a certificate using OpenSSL under Linux (Server)

- linux raid levels and concepts introduced (Linux)

- After Pydev installation, Eclipse does not display solutions (Linux)

- Lenovo E431 notebook CentOS system is installed wireless network card driver (Linux)

- Oracle view object space usage show_space (Database)

- To install Redis under Linux (Database)

- LogStash log analysis display system (Linux)

- Linux Platform Oracle 11g Single Instance Installation Deployment Configuration Quick Reference (Database)

- Linux environment has been running Tomcat how to deploy the new Tomcat (Server)

- MongoDB Learning the notes (Database)

- using Docker Kitematic on windows (Linux)

- Python 2 Chinese garbage problem solved (Linux)

- Java implementation heap sort (large root heap) (Programming)

- MongoDB upgrade from 2.4.9 to 2.6.0 and PHP record of mongo extension upgrade from 1.4.5 to 1.5.1 (Database)

- Ten linux version of the system (Linux)

- Security basics: simple analytical framework for Linux system firewall (Linux)

- Ubuntu 14.04 next upgrade to GNOME 3.12 (Linux)

- CentOS 6 kernel upgrade to Kernel 3.x (Linux)

  Linux System Getting Started Learning: Disable HTTP forwarding wget in
  Add Date : 2017-04-13      
  Question: When I use wget to obtain a redirect to the URL X URL Y's, wget will automatically get the default URL Y. However, I want to compulsorily acquire URL redirection without X. How do I disable wget redirection URL.

In the HTTP standard, redirect response (HTTP response with the 3XX) Description URL request is moved to a new location. Redirect the corresponding target then contains a URL redirect.

Like regular HTTP client, wget support URL redirection (also called URL forwarding), means that when you try to download a URL redirection, wget will automatically follow URL redirects access to resources are redirected to. If for some reason you want to disable URL redirection, and stop 3XX status code, you can use wget's "--max-redirect = number" option. This option is used to specify the maximum numbers (recursive) redirection, the default is 20.

If you want to disable the HTTP redirect wget, use the "--max-redirect = 0"

$ Wget --max-redirect = 0 http://www.aaa.com/a.html
--2014-10-3123: 08: 58-- http://www.aaa.com/a.html
Resolving aaa.com (aaa.com) ...
Connecting to aaa.com (aaa.com) | |: 80 ... connected.
HTTP request sent, awaiting response ... 301MovedPermanently
Location: http://www.bbb.com/b.html [following]
0 redirections exceeded.
As you can see, when wget encounter HTTP redirect response, it does not follow the redirect, and "0 redirections exceeded" (beyond 0 redirects) error message stops. It also displays a HTTP status code (such as 301).

Note curl, another similar HTTP client, the opposite behavior. Default, curl and will not follow URL redirects. To force the cutl redirected to a URL, you have to use "-L" option.
- PostgreSQL procedural language learning (Database)
- CentOS 7 hard disk expansion toss record (Linux)
- OpenGL Superb Learning Notes - Fragment Shader (Programming)
- Linux Mint 17.2 64 bit installation Docker and management software seagull (Linux)
- Use in Linux ipmitool tool (Linux)
- List Leaves (Programming)
- How VMware extend disk without rebooting the system (Linux)
- AngularJS achieve picture upload feature (Programming)
- Depth understanding of the TCP protocol (Database)
- Linux OOM killer mechanism (Linux)
- Python2 ---- function using dictionaries (Programming)
- Installation Docker FAQ on Ubuntu (Linux)
- RedHat Linux 6 desktop installation (Linux)
- RedHat Linux 6.4 installation RTL8188CUS wireless network card driver (Linux)
- CentOS x86 64bit upgrade to 2.7 Python2.6 (Linux)
- 10 Codes of good practice PHP (Programming)
- Java reflection by calling the class method (Programming)
- Oracle database file path changes (Database)
- 20 Top Linux commands (Linux)
- Ubuntu file security removal tool (Linux)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.