简体   繁体   中英

.htaccess allow access to more than one file PHP

I have a three files that I would like to allow access to, (home.php, contact.php, login.php). I also have a folder containing assets (assets) that I would like to deny direct access to.

This is my code but its denying access to every file/folder.

Order deny,allow
Deny from all

<Files "home.php|contact.php|login.php">
    Order Allow,Deny
    Allow from all
</Files>

I've looked on SO, but no one covered this topic, so this aint a duplicate.

THANKS

This example shows how you can allow only few file types and deny other requests. Add this to your assets folder.

Order Allow,Deny

<FilesMatch "\.(html|css|js)$">
    Order Deny,Allow
    Allow From All
</FilesMatch>

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