1

I am using two website on one domain like: www.example.com & www.example.com/site2. I want to know that on my site2, in my site2 their are 2 folders name folder1 and folder2 my index.php is in folder2 but the definition of methods defined in folder2 I am including the files through .htaccess but I am unable to get those files which are in folder1 and getting Error-500 and 400 on browser and I am using following lines but they are not working in .htaccess file

The line below works fine

RedirectMatch ^/$ http://www.example.com.pk/site2/views/

AllowOverride All
php_value include_path ".:/home/example/public_html/site2/system"
user9517
  • 115,471
  • 20
  • 215
  • 297

2 Answers2

0

Are you trying to include your methods and classes for use by PHP? If so, you most likely want to use include() or require() functions within your PHP code rather than doing it through Apache.

I can't really tell from your question exactly what you are trying to achieve. If you really need to use Apache for your includes, please expand your question to give more details.

dunxd
  • 9,632
  • 22
  • 81
  • 118
  • well yes i really need to use Apache, their are two folders name: "system" which have database layer which can interact with DB and second folder name: "views" which have all html, php files and sub-folders in php files or in sub-folders i want to just add this in php or in subfolders having php files: include ("database/db_call.php"); because previous path was defined in .htaccess – Hammad Haider Dec 23 '10 at 07:59
  • If you are including files which have php code in that must be executed, you need to use PHP include functions. You don't need to use Apache .htaccess or httpd.conf to achieve this. See the link I added to my answer for more info. – dunxd Dec 23 '10 at 09:15
0

Also, your current .htaccess file doesn't include files, it only sets the include path that php uses. So, imagine this file tree:

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

When you include in the php file myphp.php, normally you would do this:

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

But after setting

AllowOverride All php_value include_path "root/b/"

you only need to type

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

but that really doesn't make a big difference doesn't it? Please read through the php.net pages about include, require and include_once, require_once.

Herman
  • 101
  • 3