Forum Moderators: phranque

Message Too Old, No Replies

htaccess problem with PHP parameter

         

Ian_T

8:01 pm on Mar 9, 2007 (gmt 0)

10+ Year Member



I have the following code in my htaccess file:

RewriteEngine on
RewriteRule ^images/([0-9]+)/$ index.php?image=$1

This is to convert URLs in the form:

www.mysite.com/images/80/

to:

www.mysite.com/index.php?image=80

This works, and the browser finds the correct page. However, in the HTML, all of the files that make up the page (CSS, JS and JPEG) are referred to by their filename only, as they are in the same directory as index.php.

The problem is, that after redirection the browser is looking for the files in the wrong place, e.g. www.mysite.com/images/80/main.css instead of www.mysite.com/main.css.

Anyone got any ideas why this is? Surely I don't have to link to every file and image with a full file path do I?

Thanks for any help!

Ian_T

8:38 pm on Mar 9, 2007 (gmt 0)

10+ Year Member



Well, I've found one way of solving it...

<base href="http://www.mysite.com">