且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何设置PHP包括通过htaccess的路径?

更新时间:2023-02-21 22:50:31

的Apache必须被配置为允许设置通过的.htaccess覆盖。检查你的Apache配置文件(httpd.conf)中的一个覆盖你的目录:

Apache must be configured to allow settings to be overridden via .htaccess. Check your Apache config file (httpd.conf) for an override for your directory:

<Directory "/directory/containing/your/htaccess/file">
    AllowOverride All
</Directory>

为您的网站的虚拟主机定义中把这个。

Place this within the vhost definition for your site.

如果这是一个全球性的变化,你应该改变的include_path设置在php.ini文件,而不是使用的.htaccess。

If this is a global change, you should change the include_path setting in your php.ini file instead of using .htaccess.

这两个变化将需要一个Apache重新启动。

Both of these changes will require an Apache restart.

修改

这是从阿帕奇睿报价功能页面

假设要访问的文件名是/home/abc/public_html/abc/index.html。 服务器认为每个/,/家,/家庭/ ABC为/ home / ABC /的public_html和/ home / ABC /的public_html / ABC的顺序。在Apache的1.2,在/家庭/ ABC被认为是,正规的前pression将匹配和应用。在Apache 1.3中的常规EX pression不认为在所有的树中的那个点。它不会被认为后才一切正常和.htaccess文件已经被应用。然后定期EX pression将匹配在/ home / ABC /的public_html / ABC和应用。

"Suppose that the filename being accessed is /home/abc/public_html/abc/index.html. The server considers each of /, /home, /home/abc, /home/abc/public_html, and /home/abc/public_html/abc in that order. In Apache 1.2, when /home/abc is considered, the regular expression will match and be applied. In Apache 1.3 the regular expression isn't considered at all at that point in the tree. It won't be considered until after all normal s and .htaccess files have been applied. Then the regular expression will match on /home/abc/public_html/abc and be applied."

我认为,根据这些信息,你的 php_value include_path中语句被评估的的.htaccess文件。如果是这样的话,你在的.htaccess使用的include_path 的值被覆盖。你可以尝试从&LT删除的include_path 线;目录&GT; 暂时以测试这个理论

I think, based on this information, that your php_value include_path statement is being evaluated after the .htaccess file. If that is the case, the value you use for include_path in the .htaccess is being overwritten. Can you try removing the include_path line from <Directory> temporarily to test this theory?