Welcome to WebmasterWorld Guest from 54.158.51.150

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)

10+ Year Member



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)

10+ Year Member



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)

10+ Year Member



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)

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



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)

WebmasterWorld Senior Member 10+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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)

10+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month