Marlon Fowler
Marlon Fowler

Reputation: 121

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?

Upvotes: 1

Views: 15535

Answers (1)

Panama Jack
Panama Jack

Reputation: 24478

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

Upvotes: 5

Related Questions