如何在public_html 403 forbidden中设置sub directories/folders
How set sub directories/folders in public_html 403 forbidden
我将 Codeigniter 与 Hostgator 共享主机一起使用。
如何在public_html 403 forbidden中设置sub directories/folders?但此文件夹中的文件是可访问的。
示例:
/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/ [L]
SetEnvIf Origin "http(s)?://(.+\.)?mydomain\.com(:\d{1,5})?$" CORS=[=12=]
Header set Access-Control-Allow-Origin "%{CORS}e" env=CORS
Header merge Vary "Origin"
转到 Codeigniter/application 文件夹
复制 index.html
并将其粘贴到 /public_html
当有人试图打开 /public_html 时 index.html 会自动触发。
index.html 显示 "Directory access is forbidden."
对于您想要的东西,也许有更好的方法。将 application
和 system
目录移动到 public_html
之外,然后在 public_html/index.php
文件中设置这些目录的新路径应该是:
$system_path = '../system'; // line 93
和
$application_folder = '../application'; // line 110
在禁止从浏览器访问的目录中:
放置一个包含以下内容的 .htaccess 文件:
order deny,allow
deny from all
但如果可能,请将这些目录移到文档根目录之外
附录
我忘了:对于 Apache 2.4,语法是
Require all denied
而不是旧 Apache 版本的 2 行
我将 Codeigniter 与 Hostgator 共享主机一起使用。
如何在public_html 403 forbidden中设置sub directories/folders?但此文件夹中的文件是可访问的。
示例:
/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/ [L]
SetEnvIf Origin "http(s)?://(.+\.)?mydomain\.com(:\d{1,5})?$" CORS=[=12=]
Header set Access-Control-Allow-Origin "%{CORS}e" env=CORS
Header merge Vary "Origin"
转到 Codeigniter/application 文件夹
复制 index.html
并将其粘贴到 /public_html
当有人试图打开 /public_html 时 index.html 会自动触发。
index.html 显示 "Directory access is forbidden."
对于您想要的东西,也许有更好的方法。将 application
和 system
目录移动到 public_html
之外,然后在 public_html/index.php
文件中设置这些目录的新路径应该是:
$system_path = '../system'; // line 93
和
$application_folder = '../application'; // line 110
在禁止从浏览器访问的目录中: 放置一个包含以下内容的 .htaccess 文件:
order deny,allow
deny from all
但如果可能,请将这些目录移到文档根目录之外
附录 我忘了:对于 Apache 2.4,语法是
Require all denied
而不是旧 Apache 版本的 2 行