首页 > 解决方案 > $_GET throws 403

问题描述

I have a simple custom MVC app using $_GET to parse a url, and i've got it working on my dev server as well as a few different webhosts using php 7.1... but I'm trying to use x10hosting's free lamp hosting and the data being passed from $_GET is coming through as 403...

I've proved that it works on other servers as well as my own dev server with this

echo '<pre>', $route->path, $_GET['url'], '</pre>'; 

when going to the url http://app/admin... this line in my loop gives me what should be expected...

/admin
adminadmin

but on x10's server i get this

/403.shtml
admin403.shtml

I have tried encoding to base64 with urlencode($_GET) as well as disabling mod_sec in the .htaccess with

<IfModule mod_security.c>
  SecFilterEngine Off
  SecFilterScanPOST Off
</IfModule>

neither solution worked... I'm almost certain it's a server config issue but access is pretty much limited to .htaccess and php.ini .... I haven't touched php or apache in a while and am a little lost... any help would be greatly appreciated

标签: php.htaccesslamp

解决方案


这听起来像是一个 mod_security 类型的问题。而且,正如您所发现的,您无法在免费托管平台上禁用 mod_security

我在许多共享主机上遇到了 mod_sec 规则,这些规则只是根据某些参数名称来阻止请求(据说会阻止常见的 XSS 尝试)。url是一个常见的。site是另一个。只需更改参数名称即可。

“免费”托管帐户总是会有一些限制。如果这是唯一让你退缩的事情,那么你很幸运。


推荐阅读