我的文檔根目錄是/ var/www,我沒有啓用虛擬主機。 這是我的/ var/WWW的文件夾結構:apache2 httpd配置
index.php
classes (external)
controllers
models
files (img, js, css)
views (pages, components)
正如你可以看到我使用一個模型視圖控制器模式。我現在需要的是我必須在我的httpd.conf中使用正確的配置來定義只有文件夾可以被加載,並且沒有其他文件夾,以防止「未找到」消息或直接的php訪問。我如何設置?
這是我目前的httpd.conf
ServerSignature Off
ServerTokens Full
# Settings for server @ port 80.
<VirtualHost *:80>
ServerName <url>
DocumentRoot /var/www
DirectoryIndex index.php
# No one has access to the main directory.
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
# Configure the main directory
<Directory /var/www>
# Everyone has access to the main directory.
Order Allow,Deny
Allow from all
Options FollowSymLinks
AllowOverride None
# Enable clean urls.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</Directory>
</VirtualHost>
感謝您的幫助:)
OMG ofcourse,這就是爲什麼他們創建應用程序庫:P非常感謝 – randomKek 2012-03-08 01:32:35
沒問題,是Zend框架或別的東西 – drew010 2012-03-08 01:39:12
!?沒有我自己的,不喜歡大的框架,但是,嗯,現在我在/ var/application目錄中完全否認了,但我不希望用戶獲得「沒有權限」頁面,而只是重定向到索引。/var/www的php是可能的嗎? – randomKek 2012-03-08 01:42:28