.htaccessconfiguration问题

我在一个域名上使用了两个网站,例如:www.example.com和www.example.com/site2。 我想知道在我的站点2,在我的站点2他们是2文件夹名称folder1和folder2我的index.php是在folder2,但在folder2中定义的方法的定义我包括通过.htaccess的文件,但我无法得到那些在文件夹1中获取错误500和400浏览器上的文件,我正在使用以下行,但他们不工作.htaccess文件

下面的行工作正常

RedirectMatch ^/$ http://www.example.com.pk/site2/views/ AllowOverride All php_value include_path ".:/home/example/public_html/site2/system" 

你想包括你的方法和类供PHP使用吗? 如果是这样,你很可能想在你的PHP代码中使用include()或require()函数 ,而不是通过Apache来完成。

我无法从你的问题中确切地告诉你正在努力达到什么目的。 如果你确实需要使用Apache来为你的包含,请扩展您的问题,以提供更多的细节。

此外,您当前的.htaccess文件不包含文件,它只设置php使用的包含path。 所以,想象这个文件树:

 root | - a | |- myphp.php | - b | |- myinclude.extension 

当你包含在php文件myphp.php中,通常你会这样做:

 <?php include('../b/myinclude.extension'); ?> 

但设定后

 AllowOverride All php_value include_path "root/b/" 

你只需要input

 <?php include('myinclude.extension'); ?> 

但那真的不会有很大的不同吗? 请通读php.net页面,了解include,require和include_once,require_once。