Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

Software >> OS >> Unix >> curl >> How to force curl to follow the http 301 redirect response

Example we have a URL http://localhost/owndir which is a directory containing and index document


## When running curl without any option, It will just display the HTTP 301 redirect instruction from the webserver to reload http://localhost/owndir/

root@system1 html]# curl http://localhost/owndir
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://localhost/owndir/">here</a>.</p>
</body></html>


## To automatically follow the redirect instruction do the following

root@system1 html]# curl -L http://localhost/owndir
<html><body>local access only</body></html>

 

 

 

 

 

[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]