|
Posted by Joe Butler on May 11, 2008, 6:27 pm
Please log in for more thread options
I think this is an Apache issue, but I'm using php pages on an Apache
server...
The problem is that when a url such as:
example.com/?page=whatever
is url encoded to:
example.com/%3Fpage%3Dwhatever
then it appears that Apache is not seeing the %3F as a ? parameter marker,
but rather as the first character of a filename (but in an encoded form).
So, if I create a file called ?.php and then use the url:
example.com/%3F.php
the actual file called ?.php is called.
What do I do to stop this?
|
|
Posted by =?ISO-8859-15?Q?Iv=E1n_S=E1nch on May 11, 2008, 6:55 pm
Please log in for more thread options
Joe Butler wrote:
show/hide quoted text
> What do I do to stop this?
Stop urlencode()ing the whole URL, and onlt urlencode() the parameter name
and the parameter value.
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
En política, no saber hacer nada no es mayor problema.
|
|
Posted by =?ISO-8859-1?Q?=22=C1lvaro_G=2 on May 12, 2008, 4:42 am
Please log in for more thread options Joe Butler escribió:
show/hide quoted text
> The problem is that when a url such as:
>
> example.com/?page=whatever
>
> is url encoded to:
>
> example.com/%3Fpage%3Dwhatever
>
> then it appears that Apache is not seeing the %3F as a ? parameter marker,
> but rather as the first character of a filename (but in an encoded form).
That's the whole point of it all. You use "?" to start the parameters
and you use "%3F" when you have a parameter that has a "?" inside.
show/hide quoted text
> So, if I create a file called ?.php and then use the url:
> example.com/%3F.php
>
> the actual file called ?.php is called.
Correct. Otherwise, the file would be impossible to load.
show/hide quoted text
> What do I do to stop this?
It depends on how you got there :)
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com -- Mi web de humor al baño María: http://www.demogracia.com --
|
|
Posted by Joe Butler on May 12, 2008, 10:44 am
Please log in for more thread options Thank you Ivan and Alaro both for the reply. It clarified it when it was
pointed out that the URL encoding's purpose was to allow for characters such
as the ? to be interpreted as a filename character and not a special marker.
For the record:
From what you have said, it turns out there is no problem at my end
afterall, but caused by an unknown client attempting to connect to a
specific page.
I posted the 'problem' because I was seeing 404 errors in my logs. And the
file that was being asked for was a new page that is also the landing page
of a new Google Ads campain that I started. It turns out that the ad is not
encoding the URL, as is correct - I clicked my own ad and it landed on the
right page. I think that Google may be sending a 'cloaked' bot to my site -
but for some reason the bot is using an encoded URL as if it is a filename
(the URL I specified in the ad is not encoded, nor are any links that I give
on my site). Also, normal search results at Google are not url encoded
either.
I guess I can probably do some sort of rewrite rule to rewrite %3F into a
true ? character, since I don't and wouldn't use such a character in filname
or parameter. Or failing that, some sort of redirect or as a final idea,
just a hard-coded file with the unencoded filename. But, first, I guess I
need to find out what the purpose of that bot is, and also if it's
delibarately encoding the URL for a reason or if it's just a bug in the bot.
Thanks,
show/hide quoted text
>I think this is an Apache issue, but I'm using php pages on an Apache
>server...
> The problem is that when a url such as:
> example.com/?page=whatever
> is url encoded to:
> example.com/%3Fpage%3Dwhatever
> then it appears that Apache is not seeing the %3F as a ? parameter marker,
> but rather as the first character of a filename (but in an encoded form).
> So, if I create a file called ?.php and then use the url:
> example.com/%3F.php
> the actual file called ?.php is called.
> What do I do to stop this?
>
|
| Similar Threads | Posted | | Newbie question: variable setting trough question mark | July 17, 2004, 2:26 pm |
| newbie question: setting a variable from browser using question mark | July 17, 2004, 7:05 pm |
| echo with question mark | August 26, 2006, 1:34 pm |
| question mark in serialized object | August 20, 2007, 2:13 pm |
| Echo versus Question Mark Equals | August 6, 2007, 4:05 pm |
| Question about file upload encoding | January 23, 2006, 1:54 pm |
| Find out encoding of a file with php, and convert it to UTF-8 encoding | July 23, 2006, 5:26 am |
| Displaying Errors Question | January 10, 2009, 2:43 pm |
| Dumb newbie question: locating syntax errors | March 25, 2005, 5:00 pm |
| help : apostrophe/single quotation mark | March 6, 2007, 4:32 am |
|