Welcome to WebmasterWorld Guest from 23.22.140.143

Forum Moderators: brotherhood of lan & mack

Message Too Old, No Replies

How can I change ALL links from absolute to relative?

Have to burn a cd with my site on it...

     
4:31 pm on Nov 12, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 17, 2001
posts:126
votes: 0


Thing is, it would be easier to do online(just find and replace "www.foobar.com" with "/") but I have to change ALL the links in my site so they will work on a cd!
Any1 knows a fast way to do this?
Thanks in advance!
4:38 pm on Nov 12, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Feb 5, 2002
posts:333
votes: 0


in unix you could edit all your html files using sed.

if you had a whole bunch of *.html files you would create a file say called editfile, this file would contain:

s/http:\/\/www\.foobar\.com\///g

then edit all the files using the following command
sed -f editfile *.html

the edit file can contain multiple lines, each doing a different substitution.

4:45 pm on Nov 12, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 17, 2001
posts:126
votes: 0


Thanks, but I don't have any kind of access to unix...
And I want to change all the links in a COPY of the site(that will get burned on a cd) so all of the links will work in a local/cd site...
Thanks!
4:52 pm on Nov 12, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 25, 2002
posts:3185
votes: 0


There is a probuct out there called Search and Replace [funduc.com] which will grep an entire directory for a specified file type (in your case *.html), and replace a search string (www.foobar.com) with a new string... it runs on Windows.

This might be what you're looking for?

4:58 pm on Nov 12, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 22, 2002
posts:1782
votes: 0


Did you consider putting a web server on the cd as well? This way you could even run PHP or Perl scripts. Just make sure that the server may write its logfiles to a directory on your hd.

Andreas

5:11 pm on Nov 12, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 16, 2001
posts:2006
votes: 0


If you want to burn your web site to a CD, try a web site grabber like wget or pavuk. For wget the syntax is:

wget -r -k [yourwebsite.com...]

-r is for recursive
-k is to convert non-relative URLs to relative

To find the free program, a google search on wget win32 will work

5:23 pm on Nov 12, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 17, 2001
posts:126
votes: 0


That was exactly what I needed! Thanks!
And does it works if I have a backup copy of my site and I try wget -r -k d:/Midget/Giant/mysite/?
Thanks in advance!
6:14 pm on Nov 12, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 16, 2001
posts:2006
votes: 0


Sorry, I do not know. Feel free to try it out yourself.