Mobile app version of vmapp.org
Login or Join
Ann8826881

: Apache redirecting: reason unknown 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.

@Ann8826881

Posted in: #Apache #Htaccess #Php

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

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

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

No redirect for x but redirects 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?

Edit:

Here's the .htaccess file

Options +FollowSymLinks

RewriteEngine On
RewriteBase /

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

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


When there is an 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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Ann8826881

1 Comments

Sorted by latest first Latest Oldest Best

 

@Phylliss660

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme