homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

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)

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)

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:


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)

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...


 4:52 pm on Nov 12, 2002 (gmt 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)

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.



 5:11 pm on Nov 12, 2002 (gmt 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)

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)

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved