wget relative url to absolute url in shell
开发者_C百科Hi I am using wget to copy a data from url and store it in a file.The url gives me a aspx file .I need to convert the aspx file to html file.SO I renamed the file from asd.aspx to asd.html.But in my file there are relative url which are not working in my html file.They should point to original url.How can i convert the relative url to their absolute url.Is there any way to achieve this,
for example
in original file link is
href='../../login.html'
but when i open the html file in my browser the link is changed to
href="localhost/login.html"
but it should be
href="abc.com/login.html"
I hope i have clear the prob
the -k option in wget will convert urls after wget is done retrieving files. links to files that have not been retrieved will point to their remote url, links to files that have been retrieved to their local version.
http://www.delorie.com/gnu/docs/wget/wget_11.html
You should add <base href="http://www.abc.com/original/path">
in the head section of the html file, wget will not rewrite the links automatically.
精彩评论