【发布时间】:2017-12-14 23:05:24
【问题描述】:
我将 Codeigniter 与 Hostgator 共享主机一起使用。
如何在 public_html 403 中设置子目录/文件夹禁止?但此文件夹中的文件是可访问的。
示例:
/public_html/this_forlder_forbidden/this-file-not-forbidden.ext
示例 1
/public_html/js/jquery.js
/public_html/css/style.css
以下是我在 /public_html/ 目录中的 .htaccess 文件代码。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
SetEnvIf Origin "http(s)?://(.+\.)?mydomain\.com(:\d{1,5})?$" CORS=$0
Header set Access-Control-Allow-Origin "%{CORS}e" env=CORS
Header merge Vary "Origin"
【问题讨论】:
-
你可能只想要
Options -Indexes。 httpd.apache.org/docs/2.2/mod/core.html#options
标签: php .htaccess codeigniter cpanel shared-hosting