mod_rewrite Directory Problem



I'm trying to replace a PHP query string with virtual directories using Apache's mod_rewrite. Here's my test .htaccess:

RewriteEngine on
RewriteRule ^qqq$ database.php?cat=0
RewriteRule ^qqq/xxx$ database.php?cat=0

The problem is that database.php contains several relative paths to images. This means mydomain/qqq works fine and all the images are found but when typing mydomain/qqq/xxx the file database.php seems to think it is in the xxx directory and cannot find the images.

What, apart from not using relative paths in database.php, can be done to make things work correctly so that database.php always thinks it is in the root directory and finds the images?

Regards

R.
.



Relevant Pages

  • Re: mod_rewrite problem
    ... Im havin' problem with images in pages that were mod_rewrite-n. ... in .htaccess with directives: ... problem because server appends image path to virtual directory /blog/ ... I found RewriteRule that should solve my problem but it doesn't work. ...
    (alt.php)
  • Re: mod_rewrite Directory Problem
    ... RewriteRule ^qqq/xxx$ database.php?cat=0 ... This means mydomain/qqq works fine and all the images are ... What, apart from not using relative paths in database.php, can be done ... in the root directory and finds the images? ...
    (comp.lang.php)
  • mod_rewrite problem
    ... Im havin' problem with images in pages that were mod_rewrite-n. ... in .htaccess with directives: ... problem because server appends image path to virtual directory /blog/ ... I found RewriteRule that should solve my problem but it doesn't work. ...
    (php.general)
  • mod_rewrite problem
    ... Im havin' problem with images in pages that were mod_rewrite-n. ... in .htaccess with directives: ... problem because server appends image path to virtual directory /blog/ ... I found RewriteRule that should solve my problem but it doesn't work. ...
    (alt.php)