Forum Moderators: phranque

Message Too Old, No Replies

RewriteRule and Special Chars - "Access Denied"-Error appear

"Access Denied"-Error appear

         

SavinienCyrano

9:48 pm on Aug 11, 2005 (gmt 0)

10+ Year Member



Hi,

I've got the following problem:

I'd like to rewrite the URL http://domain.de/p_hallo_14,15,16_1.png
into http://domain.de/skript.php?s=hallo&b=14,15,16&st=1.

In order to do that, I created a RewriteRule:

RewriteRule ^p_(.*)_(.*)_(.*).png$ skript.php?s=$1&b=$2&st=$3 [L]

Basically, this works great, but I got problems with the appearance of German "Umlauts" and other special chars in the URL.

If I try, for example, to open the URL http://domain.de/p_hällo_14,15,16_1.png, I only get an "Access denied" error. The "ä" is replaced by the Hex-Code "%E4", and exactly this seems to be the problem.

All special chars, whose Hex-Codes begin with a number (e.g. %4A) work without problems. Only chars, whose codes start with a letter (like the "ä" above) produce the error message.

Is this a known problem? Do you have any idea to resolve it? Help would be greatly appreciated.

Cyrano

PS: The same error comes up if I replace the special chars myself using the PHP-function urlencode().

jdMorgan

12:08 am on Aug 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cyrano,

Welcome to WebmasterWorld!

I'm no expert on character-encoding issues, but try the following modified rule and see if anything changes. Maybe nothing will change, but it's worth a try.


RewriteRule ^p_([^_]+)_([^_]+)_([^.]+)\.png$ /skript.php?s=$1&b=$2&st=$3 [NE,L]

The modified regex patterns will also be much more efficient than ".*"

Also, take a look at your server error log after you get an error, and see what it says. Sometimes the information is very useful, sometimes not. Examine the URL shown in the log that caused the error and see if it is unexpectedly modified or malformed; Sometimes that information helps to determine where the problem is.

Jim

SavinienCyrano

6:31 am on Aug 12, 2005 (gmt 0)

10+ Year Member



Hi,

thanks for your reply, unfortunately, it didn't help. I just checked the access.log, and found the following:

80.137.116.xx - - [12/Aug/2005:08:24:23 +0200] "GET /publico/p_%F6ftfhj_6,11,13,14_1.png HTTP/1.1" 403 1095

I dont't know whether this helps.

Anyhow, I found something else that's interesting: Even if I delete the whole RewriteRule, the "Access forbidden!"-messages keep coming up! URLs without special chars produce an "Object not found" error in this case - so I suspect it's not a Rewrite-problem at all and an issue with the server configuration instead?

Cyrano