Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux System Getting Started Learning: Disable HTTP forwarding wget in     - Android Qemu GPS module (Programming)

- To install file manager Nautilus 3.12.2 under ubuntu (Linux)

- The Java development environment to build under Ubuntu 14.04 (Linux)

- Ease of use "Explain Shell" script to understand Shell command (Linux)

- C # DateTime structure common method (Programming)

- Ubuntu users install the video driver Nvidia Driver 334.21 (Linux)

- CentOS 6.6 install JDK7 (Linux)

- Spring use Cache (Programming)

- Easy to install CentOS 6.6 desktop environment (Linux)

- Shell Scripting Interview Questions (Programming)

- How to disable IPv6 on Ubuntu, Linux Mint, Debian (Linux)

- Modify Linux SSH default port 22 in several ways (Linux)

- Scope of variables in C # (Programming)

- Use OpenSSL to generate a certificate (Linux)

- Linux System Getting Started Learning: Statistical process a number of threads in Linux (Linux)

- Ubuntu 14.10 users to install Audio Recorder 1.5.7 (Linux)

- Awk include binding capacity larger than the specified size of all files directory (Linux)

- VMware virtual machine Ubuntu install arm-linux-gcc cross-compiler environment (Linux)

- iptables using summary (Linux)

- 30 Practical Linux system administrators will learn the command (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) ... 1.2.3.4
Connecting to aaa.com (aaa.com) | 1.2.3.4 |: 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.
     
         
       
         
  More:      
 
- Linux - Common process the command (Linux)
- To setup Cocos2dx project under Ubuntu (Linux)
- Steps to build MPICH2 development environment on CentOS 6.4 (Linux)
- Use DB2 federated access Oracle (Database)
- Python configuration tortuous road of third-party libraries Numpy and matplotlib (Programming)
- Eclipse remove all comments and code spaces (Linux)
- GO five stages of language learning (Programming)
- Linux iostat command example explanation (Linux)
- Oracle partition table data migration, process management automation (Database)
- Add a custom encryption algorithm in OpenSSL (Linux)
- Java memory area (Programming)
- Python KNN algorithm of actual realization (Programming)
- How to understand Python yield keyword (Programming)
- Git uses Details (Linux)
- Android project using the command to create and install the package (Programming)
- Hands to teach you to solve Ubuntu error message (Linux)
- MySQL master-slave database configuration and error handling Raiders (Database)
- Security experience: to see how the experts deal with DDoS attacks (Linux)
- Cobbler automatic mass deployment of CentOS 6 and CentOS 7 (Linux)
- How to install Bugzilla 4.4 on Ubuntu / CentOS 6.x (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.