简体   繁体   中英

Exclude a specific php file from wp-content .htaccess

I have a wordpress theme which calls a dynamic css file called frontend.css.php which is located at wp-content/my-theme/assets/dynamic/frontend.css.php

For security purpose, i've obviously protected my wp-content excluding php files and allowing specific files format. This is the following htaccess

https://www.wpexplorer.com/htaccess-wordpress-security/ Part 3 wp-content section

I've tried different alternatives to try to still allow these file format, keep excluding php files from being accessible BUT allow the frontend.css.php file, as it returns error 403 because it's a php file.

Any idea how i could add to this htaccess frontend.css.php to the list of allowed files (and only that php file)

Thanks

thanks for the answer.

I found the solution so i'll post it here in cas someone try to achieve something similar. I need to write the file outside the parenthesis and append it like if it was also in parenthesis.

Order deny,allow
Deny from all
<Files ~ "frontend.css.php|.(xml|css|js|jpe?g|png|gif|ttf|woff|otf|pdf|docx|rtf|odf|zip|rar|mp4|vp9|mkv|mp3|aac|wav|flac)$">
Allow from all
</Files>

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