简体   繁体   English

htaccess允许访问一个PHP文件

[英]htaccess allow access to one PHP file

My initial .htaccess allows access only to non-php files in a directory: 我的初始.htaccess只允许访问目录中的非php文件:

Order deny,allow
Deny from all
<Files ~ ".(xml|css|jpe?g|png|gif|js|pdf)$">
  Allow from all
</Files>

I want to allow access now to one specific php file (relative path from .htaccess foo/bar/baz.php) 我想允许现在访问一个特定的php文件(相对路径来自.htaccess foo / bar / baz.php)

Tried adding 尝试添加

<Files foo/bar/baz.php>
  order deny,allow
  Allow from all
</Files>

also tried 也试过了

<Files ~ "(baz)$">
  order deny,allow
  Allow from all
</Files>

How do I add access for this one file? 如何为这个文件添加访问权限?

Can you try: 你能试一下吗:

Order deny,allow
Deny from all

<Files ~ "\.(xml|css|jpe?g|png|gif|js|pdf)$">
  Allow from all
</Files>

<Files ~ "baz\.php$">
  Allow from all
</Files>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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