2012-10-10 45 views
1

我安裝了apache2。 和我有3個directorioes用的index.php,都具有相同的index.php只是目錄DOC2有data.php如何在apache2中使用scriptAlias

  • -doc1 ---->的index.php

  • -doc2 ---->的index.php和data.php //此目錄中,我有index.php文件whitch內容要求 「dates.php」

    • 的index.php

      <? 
      print "Hello"; 
      require 'data.php'; //when it works show Hello there ?> 
      
    • data.php

      ?> print "hello there" ?> 
      
  • -doc3 ---->的index.php

我正在尋找從-doc3調用data.php的方式-doc1 index.php和-doc3 index.php 我聽說過有關ScriptAlias的一些信息,但我是用apache2搭檔的,有誰知道如何使用它?

+0

所有3個「doc」目錄是否爲不同的網站記錄了根目錄?這意味着什麼:**「m尋找從-doc3到-doc1 index.php和-doc3 index.php調用data.php的方式」**? –

回答

1

您應該能夠爲相對路徑使用的curently運行PHP文件:

<?php 

    require '../doc2/data.php'; 
1

Alias指令使存儲在比的DocumentRoot下的其他本地文件系統中的文件。具有以URL-path開頭的(%-decoded)路徑的URL將映射到以directory-path開頭的本地文件。即使在不區分大小寫的文件系統中,URL路徑也區分大小寫。

Alias /image /ftp/pub/image 
<Directory /ftp/pub/image> 
Order allow,deny 
Allow from all 
</Directory> 
相關問題