mod_rewrite and include paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This seems like a simple problem...

I have a rewrite like this:

RewriteRule ^x/([0-9]+) x.php?x=$1 [PT,L]

This maps a url like http://www.example.com/x/123 to http:// www.example.com/x.php?x=123

x.php contains a line to include some class like:

require_once 'x.class.php';

My include path contains '.' (plus paths to pear, etc), and the class file is in the top level directory.

This configuration will fail with a file not found error. Because of the rewrite, PHP ends up looking for x/x.class.php instead of just x.class.php. If I change the PT option to R (AKA ugly mode), it works fine as PHP gets to know about the real URL.

So how can I get PHP to look in /? I can set include_path with a php_value in .htaccess, but I can only set it absolutely (losing existing values), not add to it (AFAIK?). I don't want to add an absolute path to my global include_path as there may be multiple independent deployments of the same scripts on the server, and I don't want them including each others files. Adding .. to the path would work but is a security risk. Any other ideas?

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcus@xxxxxxxxxxxxxxxxxx | http://www.synchromedia.co.uk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux