如何允许使用 htaccess 访问特定文件夹



我有一个.htaccess文件,我正在尝试允许访问我们现有网站下的子网站(在文件夹中)。

我在我的 .htaccess 文件中使用以下文件,但是当我尝试导航到我想要允许的文件夹时,我收到 403 错误。

Options +ExecCGI
AddType application/x-httpd-php .php .html
AddHandler x-httpd-php5 .php .html
<Directory /teen-writers/>
Satisfy Any
Allow from all
</Directory>

我也尝试实现此代码:

<FilesMatch ".(ttf|otf|eot|woff)$">
    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
    </IfModule>
</FilesMatch>

但是当实现上述代码时,以及:

Options +ExecCGI
AddType application/x-httpd-php .php .html
AddHandler x-httpd-php5 .php .html 

我有权访问子网站/文件夹,但随后我的一个.html页面不再呈现为.php页面。

有什么建议吗?

你不能在 htaccess 中使用 Directory 指令。尝试将其放入teen-writers文件夹中的htaccess文件中。

Order allow,deny
Allow from all

最新更新