[SOLVED] Very strange URL query error...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jraede
Forum Contributor
Posts: 254
Joined: Tue Feb 16, 2010 5:39 pm

[SOLVED] Very strange URL query error...

Post by jraede »

I have multiple sites running off the same install of a custom CMS. I've run into a strange problem on those that are accessed by custom URLs (http://www.my-url.com) and not on those that are still accessed as a folder on my main site.

The problem is when they try to access the admin panel, they are redirected to the login form, with a URL query variable for "redirect" and "alert". The alert tells the form what sort of message to display, and the redirect tells it where to point the user after they log in successfully.

Say the site is http://www.site.com. When the redirect variable is "http%3A%2F%2Fsite.com%2Fadmin%2F" the $_GET global is empty, even if I var_dump it on the very first line of the index file. Weird. However, when the redirect variable is "http%3A%2F%2Fwww.site.com%2Fadmin%2F", i.e., with the WWW, the $_GET variable is set correctly. The opposite is true for when you access the site without the www. If the redirect variable has a http://www., the $_GET global is empty. Without the www, the $_GET global is set correctly.

I'm utterly confused. Could this be due to the fact that my htaccess file is routing everything to the index, and maybe recognizing the URL query variable as something other than what it is? I'm thinking a temporary solution is to just pass the redirect variable as md5 or some other hash and then un-hashing it before use, but I'd still like to know why this is happening.

My .htaccess file looks like this:

[syntax]
Action application/x-hg-php53 /cgi-sys/php53
AddHandler application/x-hg-php53 .php

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
[/syntax]

Any help would be appreciated.
jraede
Forum Contributor
Posts: 254
Joined: Tue Feb 16, 2010 5:39 pm

Re: [SOLVED] Very strange URL query error...

Post by jraede »

Figured it out...it's a problem with host gator. Apparently they filter out all url query variables that are URLs that aren't the current site's URL. Annoying, but I'll work around it.
Post Reply