Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 25558 invoked from network); 5 Oct 2005 16:45:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Oct 2005 16:45:35 -0000 Received: (qmail 41392 invoked by uid 500); 5 Oct 2005 14:50:46 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 41378 invoked by uid 500); 5 Oct 2005 14:50:46 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 41367 invoked by uid 99); 5 Oct 2005 14:50:46 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2005 07:50:46 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [69.36.186.178] (HELO saqibkadri.net) (69.36.186.178) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2005 07:50:51 -0700 Received: (from root@localhost) by saqibkadri.net (8.11.6/8.11.6) id j95EoSD08805; Wed, 5 Oct 2005 08:50:28 -0600 Date: Wed, 5 Oct 2005 08:50:28 -0600 Message-Id: <200510051450.j95EoSD08805@saqibkadri.net> From: "Saqib Kadri" To: users@httpd.apache.org X-Mailer: NeoMail 1.25 X-IPAddress: 70.111.70.239 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Subject: [users@httpd] mod_rewrite Special % character problems X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello all, I'm having problems with rewriting URLs that contain the special character codes for ampersands and forward slashes - %26 and %2F. Rewriting other special characters, like %20, %21, etc., doesn't cause any problems; but these two (and perhaps others) do, as mod_rewrite/.htaccess seem to "pre-decode" them. i.e., it thinks that %2F is an actual backslash (thus giving 404 errors and such). A solution is to always use '%25' instead of '%'; e.g., placing %2526 and %252F in the URL. Because mod_rewrite seems to "pre-decode" the %25 it will interpret these as %26 and %2F; however, this leads to further problems, as a direct, un-Rewritten link will not pre-decode the %25. e.g., given the following in .htaccess: RewriteRule ^folder/(.*)/(.*) script.php?vara=$1&varb=$2 (with or without [NE] flag) The URL of: example.com/folder/apples%2526oranges/more Will give GET variable 'vara' a value of '&'. However going to: example.com/script.php?vara=%2526&varb=more Will give 'vara' a value of %26. This leads to potentially problematic issues during programming, e.g. the programming of internal links, and decoding of GET variables. Is there any way to resolve this issue? Also, why does mod_rewrite treat certain character codes (%26, %2F) differently from others - and are there any more characters that mod_rewrite has trouble decoding, like %26 and %2F? Many thanks, Saqib --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See 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