简体   繁体   中英

How can I allow access to a specific folder with htaccess?

I have an .htaccess file and I am trying to allow access to a sub website (within a folder) under our existing site.

I'm using the following within my .htaccess file, but when I try to navigate to the folder that I want allowed I get a 403 error.

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

<Directory /teen-writers/>
Satisfy Any
Allow from all
</Directory>

I have also tried implementing this code:

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

But when the above code is implemented, along with:

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

I have access to the sub site/folder, but then one of my .html pages is no longer rendered as a .php page.

Any suggestions?

You can't use the Directory directive inside htaccess. Try putting this in an htaccess file inside teen-writers folder.

Order allow,deny
Allow from all

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM