Is it possible to grep
a string on a URL, which is 301 Moved Permanently
? For example on this URL:
I need to grep
a string using curl
Litujeme, ale stránka nebyla nalezena
I tried via curl, but it shows me only this, no such string is present.
<!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="https://eshop.unihobby.cz/bydleni-prani-a-zehleni-zehlici-prkna-zehlici-prkno-airboard-premium-leifheit/130475p/">here</a>.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at eshop.unihobby.cz Port 80</address>
</body></html>
It's not very clear what you are asking but in case you want
curl
to follow redirects, you can do the following:Tell curl to follow redirects:
In curl's tradition of only doing the basics unless you tell it differently, it does not follow HTTP redirects by default. Use the -L, --location to tell it to do that.
When following redirects is enabled, curl will follow up to 50 redirects by default. There's a maximum limit mostly to avoid the risk of getting caught in endless loops. If 50 is not sufficient for you, you can change the maximum number of redirects to follow with the
--max-redirs
option.Syntax:
So, you should use: