从domain.com删除对phpmyadmin的访问权限

时间:2016-08-20 15:52:30

标签: .htaccess phpmyadmin

从我的域名中,任何人都可以访问phpmyadmin,只有阻止他们的是登录。尝试使用.htaccess将/phpmyadmin重定向到404,但不会阻止它。

听说可以从phpmyadmin.conf做,但不知道要改变什么。 有什么想法吗?

Alias /phpmyadmin "c:/wamp/apps/phpMyAdmin-4.5.3.1/"

# to give access to phpmyadmin from outside 
# replace the lines
#
# Require local
#
# by
#
# Require all granted
#

<Directory "c:/wamp/apps/phpMyAdmin-4.5.3.1/">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride all
  <IfDefine APACHE24>
    Require all granted
  </IfDefine>
  <IfDefine !APACHE24>
    Order Deny,Allow
      Allow from all
    </IfDefine>
  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M
  php_admin_value max_execution_time 360
  php_admin_value max_input_time 360
</Directory>

1 个答案:

答案 0 :(得分:0)

您可以通过将IP列入白名单来限制对Php myadmin的访问,这样只有您才能访问phpmyadmin链接。检查下面更新的htaccess规则。

Alias /phpmyadmin "c:/wamp/apps/phpMyAdmin-4.5.3.1/"

# to give access to phpmyadmin from outside 
# replace the lines
#
# Require local
#
# by
#
# Require all granted
#

<Directory "c:/wamp/apps/phpMyAdmin-4.5.3.1/">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride all
  <IfDefine APACHE24>
    Require all granted
  </IfDefine>
  <IfDefine !APACHE24>
    Order Deny,Allow
     deny from all
     allow from <your ip> 
    </IfDefine>
  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M
  php_admin_value max_execution_time 360
  php_admin_value max_input_time 360
</Directory>