You are here: mod_rewrite and include paths « PHP « IT news, forums, messages
mod_rewrite and include paths

Posted by Marcus Bointon on 11/14/05 00:05

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@synchromedia.co.uk | http://www.synchromedia.co.uk

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация