我一直在試圖找到包括我的PHP文件是受mod_rewrite的地址更改文件的「易」的方式。PHP包含路徑與mod_rewrite的
目前我們的config.php文件位於public_html/lib/config.php文件中,我試圖做的是include('lib/config.php')
,但是它的地址被mod_rewrite改變了地址的錯誤。
E.g. 「http://www.example.com/user-profile.php?user=123」 將致力於使用include('lib/config.php')
但
「http://www.example.com/user/123」 使用include('lib/config.php')
無法找到該文件。
有什麼辦法來設置默認包括PHP文件的路徑,從而無論在何處頁位於/重寫的include('lib/config.php')
作品。
感謝
mod_rewrite應該對inlude路徑沒有影響(因爲這些路徑並不像HTTP請求那樣處理)。 – Mchl 2010-10-29 16:13:58
@Mchl說什麼。如果PHP文件是相同的,路徑將是相同的 – 2010-10-29 16:18:23