zend framework 2 공용 폴더 (예 : css
)에 대한 액세스를 어떻게 제한 할 수 있습니까? http
을 통해 폴더에 액세스 할 때 표시되는 디렉토리 목록을 숨기고 싶습니다. 하지만 파일을 응용 프로그램에서 올바르게 사용할 수 있기를 바랍니다.브라우저에서 공용 폴더에 액세스 할 때 디렉토리 목록 숨기기
가상 호스트 구성 :
<VirtualHost *:80>
ServerName server1.jobsoft.co
ServerAlias server1.jobsoft.co
DocumentRoot /var/www/html/engsvc_dev/public
ErrorLog /var/log/httpd/engsvc_dev.error.log
CustomLog /var/log/httpd/engsvc_dev.common.log common
<Directory /var/www/html/engsvc_dev/public>
DirectoryIndex index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
내 .htaccess
파일 :
이 디렉토리 목록은 내 도메인의 css
폴더에 액세스 할 때 나타납니다
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?server1.jobsoft.co$
RewriteCond %{REQUEST_URI} !^/engsvc_dev/public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public/$1
RewriteCond %{HTTP_HOST} ^(www.)?server1.jobsoft.co$
RewriteRule ^(/)?$ /public/index.php [L]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
'css' 파일은 일반적으로 공개적으로 액세스 할 수 있어야합니다. * "응용 프로그램에서 올바르게 사용"*하는 것은 무엇을 의미합니까? 클라이언트 측 응용 프로그램/코드에서 사용하려는 경우 공개적으로 액세스 할 수 있어야합니다. 서버 측 코드에서 사용하려는 경우이 파일을 공용 폴더에서 제거하는 것이 좋습니다. – Wilt
브라우저에서 구조를 표시하고 싶지 않거나 불가능합니다. –
[여기] (https://www.thesitewizard.com/apache/prevent-directory-listing-htaccess.shtml) 또는 [여기] (http://stackoverflow.com/questions/2530372/how-do-i)를 확인하십시오. -disable-directory-browsing) – Wilt