phpMyAdmin和Apache – 查询string – 404错误

当phpMyAdmin尝试访问URL为https://example.com/phpmyadmin/server_variables.php&filter=long_query_time时 ,Apache将引发404错误。

可能是什么问题?

The requested URL /phpmyadmin/server_variables.php&filter=long_query_time was not found on this server. Apache/2.4.27 (Ubuntu) Server at example.com Port 443 

当我改变& ? ,一切都像魅力一样工作。 我的phpmyadmin.conf如下所示:

 Alias /phpmyadmin "/usr/share/phpmyadmin" <Directory "/usr/share/phpmyadmin"> DirectoryIndex index.php AllowOverride All Options FollowSymlinks Require all granted </Directory> 

/usr/share/phpmyadmin .htaccess如下所示:

 AuthType Basic AuthName "Restricted access!" AuthUserFile /usr/share/phpmyadmin/.htpasswd Require valid-user 

phpMyAdmin版本是:4.7.3

这是完全正常的,因为一个URL有这些分隔符的确切分隔符:

 scheme://host:port/path?query 

这意味着下面的URL是完全不同的:

  • https://example.com/phpmyadmin/server_variables.php?filter=long_query_time

    这里, phpmyadmin/server_variables.phppathfilter=long_query_time 查询 。 Apache可以findserver_variables.php并将这个GET方法查询的variables传递给PHP。

  • https://example.com/phpmyadmin/server_variables.php&filter=long_query_time

    这个只有pathphpmyadmin/server_variables.php&filter=long_query_time 。 由于没有这样的文件,Apache显示错误404 ,因为它应该这样做。

&则用作查询中variables之间的分隔符,例如?foo=123&bar=456