网站禁止ip访问,于是就通过配置Apache达到了想要的效果。
1.修改httpd-vhosts.conf
#加入下列内容
<VirtualHost *:80>
ServerName * #直接输入 * 即可
<Location />
Order Allow,Deny
Deny from all
</Location>
</VirtualHost>
# 以下是正常访问内容
<VirtualHost *:80>
DocumentRoot /alidata/www/phpmyadmin
ServerAlias yourdomain
<Directory "/alidata/www/phpmyadmin">
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)-htm-(.*)$ .php?
RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ /simple/index.php?
</IfModule>
ErrorLog "/alidata/log/httpd/phpmyadmin.log"
CustomLog "/alidata/log/httpd/phpmyadmin_custom.log" common
</VirtualHost>
2.重启服务
powershell service httpd restart