繁体   English   中英

我不能用 <Files> 在apache中标记以防止我的文件被其他人访问

[英]I can't use <Files> tag in apache to prevent my file from others' access

我现在正在使用wordpress。 今天我发现我的xmlrpc.php文件已启用。 现在,我要禁用它。 但我在下面做的不起作用

<Files xmlrpc.php>
    Order Deny,Allow
    Deny from all
</Files>

实际上,所有* .php文件都不能以这种方式工作。 但是,如果文件不以.php结尾,则可行

<Files "test.txt">
    Order Deny,Allow
    Deny from all
</Files>

这是我的.htaccess文件,我也尝试在httpd.conf中写它,结果相同

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>
<Files xmlrpc.php>
    Order Deny,Allow
    Deny from all
</Files>
<Files "php_test.php">
    Order Deny,Allow
    Deny from all
</Files>
<Files "test.txt">
    Order Deny,Allow
    Deny from all
</Files>

的test.txt

当我在服务器中访问test.txt时,我得到了这个。 但是php_test.php我得到了这张照片

php_test.php

我已经尝试了很多方法来解决这个问题,现在我需要帮助,谢谢你们

我有替代解决方案放在网站相关插件的代码下面。

add_filter('xmlrpc_enabled', '__return_false');

@Parth Chavda

ProxyPass /xmlrpc.php !

将上面的代码放在<Virtual Host *80>标记中下面代码的前面

ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:10000/yjdata/www/wordpress/$1

并尝试访问http://www.yourdomin.com/xmlrpc.php ,你得到这个!!!!

Forbidden

You don't have permission to access /xmlrpc.php on this server

这个问题得到解决。感谢Parth Chavda的帮助。

暂无
暂无

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

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