hopefully someone can help me with this as it's driving me crazy.
I want to be able to accept URLs containing a calculation such as:
http://www.calcatraz.com/api/calc/3*3.txt
And rewrite them it this format:
http://www.calcatraz.com/calculator/api.php?a=calc&c=3*3&f=.txt
The above case works fine when I use this rewrite rule:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteRule ^api/calc/(.+)(\.(txt|sci))?$ calculator/api.php?a=calc&c=$1&f=$2 [L]
</IfModule>
But it breaks down for URLs containing special characters, which will be URL encoded. For example 3/3 would be requested using:
http://www.calcatraz.com/api/calc/3%2F3.txt
I'd like this to rewrite, as before, to:
http://www.calcatraz.com/calculator/api.php?a=calc&c=3%2F3&f=.txt
But it doesn't - I just get an object not found error. I've played around with the 'B' flag and some others, but if they are the correct thing to use, I haven't been using them correctly!
Any pointers greatly appreciated!
%2Afor an encoded*? – Shane Madden Jul 29 '11 at 21:27/, and then encode result of it) -- yes, it does not look very nice .. but it works (in PHP script you will have to run single decoding routine). AT least give it a try. – LazyOne Jul 29 '11 at 23:26