in reply to Scripts to recursively reading in HTML files

why don't you just put a leading forward slash on all the href's in the html files?

href="/stylesheets/blah.css" will reference www.siteurl.com/stylesheets/blah.css" no matter where it's referenced from..

where as href="stylesheets/blah.css" will reference blah.css relative to the current path..

try it out :)
  • Comment on Re: Scripts to recursively reading in HTML files

Replies are listed 'Best First'.
Re^2: Scripts to recursively reading in HTML files
by mwhiting (Beadle) on Sep 01, 2004 at 01:19 UTC

    Actually that's a good, simple idea.

    It occurred to me that a 'redirect' statement in htaccess should also be able to fix this. If I redirect all calls to cgi-bin/images to /images, shouldn't this do it too?

    I'm partly asking because I've tried it and the server doesn't seem to be able to follow through the redirection and find the file. Htaccess is working, because if I put garbage in the file the server chokes on it.

    Here's the line I've used in the .htaccess file that I've put in the /cgi-bin folder:

    Redirect /images http://www.mysite.com/images/

    I believe this should redirect any calls to cgi-bin/images (which doesn't exist) to the correct folder.

    I've experimented with different arrangements of slashes, and with putting the full website address in the first parameter too - no success. The webpages that I've read which describe the use of this line make it sound like this is all it requires.

    Is it possible the server is disallowing a http call to the cgi-bin folder, since it is not a folder for web-browsing? Can my htaccess file overcome this too?

      I was the anonymous monk before (forgot to login).

      I'm not sure why you'd want to put a 'redirect' into your apache config for.. explicetely linking href's to the base URL ( forward slashes before links e.g. href="/images/somegif.jpg") will solve your problem..

      You say you've tried all manner of slashes in your links, can you show me what's *not* working?

      the leading forward slash should work for all html/image/css references, but maybe not for SSI's (i don't use SSI's so i'm not sure how it'd react)..