Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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"
share|improve this question
    
What you describe is a single web site - the first one is the root folder, and the second is a folder within the same site. –  dunxd Dec 21 '10 at 12:10
    
Did you review your question at least for a time? –  Ehsan Dec 21 '10 at 12:17
    
@Ehsan with 1 rep the review process is probably not what you'd expect :-) –  ring0 Dec 23 '10 at 12:10
add comment

2 Answers 2

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.

share|improve this answer
add comment

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.

share|improve this answer
    
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 7: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 9:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.