I have a simple php script. The script is not important. It just prints out $_SERVER.

When I request an URL like www.server.com/?ref=bar everything is fine.

However if the request contains something like www.server.com/?ref=http://www.test.com (?ref=http%3A%2F%2Fwww.test.com) the server redirects to 403.shtml.

No redirect for http://x but redirects http://x.y

As far as I can understand somehow the server doesn't like "http://x". It always redirects to 403.shtml when there is a valid query string in the form of a valid url.

my .htacess file is the same both on my server and local test server and local test server behaves as expected (no redirects). So I don't it is related to .htaccess.

I'm on shared host on Hostgator. Can anyone help?


Here's the .htaccess file

Options +FollowSymLinks

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?$1 [L,QSA]

When there is an http://xx.x it redirects to 403 even if there is physical file. However if I remove the .htaccess redirect to 403 also disappears. But I need the above .htaccess file. Is there a way to get around this?

  • Your question is not accurate enough : I guess you should post your htaccess as well as having a look on how to set up rewrite conditions here. And make sure your host enabled the rewrite module but this looks like yes from what you said.
    – hornetbzz
    Jun 28, 2011 at 22:11

1 Answer 1


I would guess Hostgator are using the Apache module mod_security, which will block any request that looks like a hacking attempt. You'll either have to change your script so it doesn't pass a URL in the query string or contact them to see if they can tweak their setup.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.