You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by malone <ma...@fxhome.com> on 2007/05/16 14:17:04 UTC

[users@httpd] AliasMatch Problem - %2f in URL causes 404

I have an AliasMatch line as follows

AliasMatch ^/(.*) "/var/www/localhost/htdocs/test.php"

My aim is to make any URL be handled by the PHP script. This works great
for all URLs, unless they have %2f in them, e.g.

http://127.0.0.1/foo%2fbar

Instead of running the PHP script apache returns a 404 error. %2f
decodes to the "/" character, so I assume that is causing problems
somewhere. I also notice on my windows machine that %5c ("\") causes the
same problem.

Why doesn't my AliasMatch line work for those URLs? Surely any URL
should be aliased to the PHP script, and it shouldn't be possible to get
a 404 message unless the script generates one.

I'm running apache-2.0.58 on i686 Linux.

Any help would be appreciated, thanks

Toby Walsh


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] AliasMatch Problem - %2f in URL causes 404

Posted by Robert T Wyatt <ro...@mail.utexas.edu>.
Robert T Wyatt wrote:
> malone wrote:
>> I have an AliasMatch line as follows
>>
>> AliasMatch ^/(.*) "/var/www/localhost/htdocs/test.php"
>>
>> My aim is to make any URL be handled by the PHP script. This works great
>> for all URLs, unless they have %2f in them, e.g.
>>
>> http://127.0.0.1/foo%2fbar
>>
>> Instead of running the PHP script apache returns a 404 error. %2f
>> decodes to the "/" character, so I assume that is causing problems
>> somewhere. I also notice on my windows machine that %5c ("\") causes the
>> same problem.
> 
> Sorry I don't have any real help here, but I think the backslash
> character is %2c (not %5c).
> 
> [using this for a reference:
> http://www.w3schools.com/tags/ref_urlencode.asp]

Nevermind! I can't read.... You had it right.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] AliasMatch Problem - %2f in URL causes 404

Posted by Robert T Wyatt <ro...@mail.utexas.edu>.
malone wrote:
> I have an AliasMatch line as follows
>
> AliasMatch ^/(.*) "/var/www/localhost/htdocs/test.php"
>
> My aim is to make any URL be handled by the PHP script. This works great
> for all URLs, unless they have %2f in them, e.g.
>
> http://127.0.0.1/foo%2fbar
>
> Instead of running the PHP script apache returns a 404 error. %2f
> decodes to the "/" character, so I assume that is causing problems
> somewhere. I also notice on my windows machine that %5c ("\") causes the
> same problem.

Sorry I don't have any real help here, but I think the backslash
character is %2c (not %5c).

[using this for a reference:
http://www.w3schools.com/tags/ref_urlencode.asp]

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: AliasMatch Problem - %2f in URL causes 404

Posted by malone <ma...@fxhome.com>.
Joshua Slive wrote:
> On 5/16/07, malone <ma...@fxhome.com> wrote:
> 
>> Instead of running the PHP script apache returns a 404 error. %2f
>> decodes to the "/" character, so I assume that is causing problems
>> somewhere. I also notice on my windows machine that %5c ("\") causes the
>> same problem.
> 
> See:
> http://httpd.apache.org/docs/2.2/mod/core.html#allowencodedslashes

Thanks, that fixed the problem.

Toby


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] AliasMatch Problem - %2f in URL causes 404

Posted by Joshua Slive <jo...@slive.ca>.
On 5/16/07, malone <ma...@fxhome.com> wrote:

> Instead of running the PHP script apache returns a 404 error. %2f
> decodes to the "/" character, so I assume that is causing problems
> somewhere. I also notice on my windows machine that %5c ("\") causes the
> same problem.

See:
http://httpd.apache.org/docs/2.2/mod/core.html#allowencodedslashes

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org