mod_rewrite
Brad Bartram
bradbartram at ccsisp.com
Tue Feb 10 10:36:56 EST 2004
On Monday 09 February 2004 03:17 pm, Mike Richardson wrote:
>
> Although I don't see how whatever.ext is supposed to be redirected to
> index.php, I can give you some pointers:
>
> http://www.engelschall.com/pw/apache/rewriteguide/
>
>
> We use something similar to this in our site
> RedirectMatch ^/assets/images/(.*)\.(.*)$ /images/$1.$2
>
> where /assets/images/img1.gif --> /images/img1.gif
> (note use of regular expressions: very handy)
>
> Might be helpful. You'd want to match everything but index.php
> (otherwise index.php will redirect to itself infinitely)
>
> Hope this helps!
>
> --
> Mike Richardson
> Unix/Linux Administrator - Web Developer
> School of Pharmacy and Pharmaceutical Sciences
> University at Buffalo
I can absolutely see why that was confusing - I screwed up my own example.
D'oh!
Here's what it should be...
I have a url:
www.somedomain.com/directory/appname.ext?var1=val1&var2=val2
What I need to do is take any request destined for:
www.somedomain.com/directory/appname.ext
and have it sent to:
www.somedomain.com/directory/index.php?appname=appname&var1=val1&var2=val2
Here is what I've been working with resulting in nothing. Regex has never
been my strong suit so I'm piecing things together haphazardly. Anyway,
enjoy the example...
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} /(.*).ext
RewriteRule ^/(.*).ext\?(.*)$ /index.php?action=%1?%2 [QSA]
Thanks for the suggestions on this so far. Due to the limitations of the
application itself, this has to be done at the apache server - I personally
would love it if it could be done at the app level 'cause then I wouldn't be
involved, but sometimes you just can't pick your poison.
brad
More information about the nflug
mailing list