mod_rewrite
Mike Richardson
mtr3 at buffalo.edu
Mon Feb 9 15:17:31 EST 2004
Brad Bartram wrote:
> Hey everyone -
>
> I need some assistance with a mod_rewrite rule for Apache that for some reason
> I just cannot get working. Hopefully someone here has some insight.
>
> 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/whatever.ext
>
> and have it sent to:
>
> www.somedomain.com/directory/index.php?appname=appname&var1=val1&var2=val2
>
> That way appname is another variable that is appended to the end of the
> request.
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
More information about the nflug
mailing list