Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite and relative paths

         

julian_lp

12:01 am on Nov 10, 2006 (gmt 0)

10+ Year Member



I've been looking for a clear explanation about the subject, and I didn't find it at all (I'm sure It was my fault though)

The problem that I'm having is that after writting an RewriteRule on my .htaccess file, all relative paths in my html suddenly get broken

my directory file (on my local server) looks like the following:

root
¦--->folder1
¦----->images

the condition on .htaccess is:

RewriteRule ^viewsong/(.*)/(.*)/(.*).php /folder1/viewsong.php?song=$1&code=$2&traspose=$3

and now, when I want to add an image (on HTML) as

img src="images/whatever.png", the browser tries to find it on

[root...]

Anyone could give me some advice to fix this nasty thing (without doing a full path to the image, of course)

best regards - julian

jd01

12:10 am on Nov 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is a directory relative path:
src="images/whatever.png"
Starts with current dir or sub-dir location => request will be /dir/sub-dir/images/whatever.png

This is a server relative path:
src="/images/whatever.png"
Starts root location => request will always be /images/whatever.png

Better to use server relative locations when rewriting/redirecting.

Justin

julian_lp

2:26 am on Nov 10, 2006 (gmt 0)

10+ Year Member



It works perfect, thanks.

BTW. I don't understand why such a hot forum like this is using some lees featured sotware like this which is currently running, insead of using vB or even phpBB... ¿?

jd01

2:32 am on Nov 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Because it's fast...

I have an idea a forum this buzy would 'choke out' a 'cool' 'off the shelf' software package in a hurry. Keeping a site this busy fast isn't a small thing.

Justin

jdMorgan

2:41 am on Nov 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This site is completely usable on a PDA at 24 kilobaud, according to recent tests... :)

Jim