Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite problem with relative image links

         

bracketsfox

2:14 pm on Feb 2, 2004 (gmt 0)

10+ Year Member



I have set up the following URL using mod rewrite

http://www.example.co.uk/DVX/1

The rewrite rule I am using is:

RewriteRule DVX/(.*) view.php?id=$1

This works for the page itself, but the page includes some relative links to image files. These dont show up, and the URL in the properties shows that the files have been rewritten to include DVX - for example:

http://www.example.co.uk/DVX/nav_images/newlogo.gif

Can anyone explain why this is happening, and what is the solution?
Thanks
Martin

[edited by: jdMorgan at 3:34 pm (utc) on Feb. 2, 2004]
[edit reason] Examplified URLs [/edit]

jdMorgan

3:41 pm on Feb 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Martin,

The links are being taken as relative to the new rewrite-defined path. You can either root the links (add "/" to the beginning) or you can modify your rewrite code to "fix" these links.

Jim

bracketsfox

3:50 pm on Feb 2, 2004 (gmt 0)

10+ Year Member



I think the better solution for my site would be to
modify the rewrite code to fix the links - can you give me any idea how this can be done.
Thanks
Martin

jdMorgan

9:11 pm on Feb 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Martin,

You'll have to examine your error log, determine where the images are being requested from, and then rewrite only those image URLs to the correct ones using an additional RewriteRule. I believe it would be just a matter of stripping out the /DVX for image-type resources.

Jim