I am trying to setup mod_rewrite on a custom site so that it will use mod_rewrite to make things a little cleaner. Gallery is embedded into my site so I can use my own user database.
Here is a snippet of the directory .htaccess file
-----------------------------------------------------------
RewriteEngine On
RewriteBase /
RewriteRule ^media/gallery/?(.*)$ multimedia.php?gallery&$1
RewriteRule ^media/gallery multimedia.php?gallery
RewriteRule ^login profile.php?login
------------------------------------------------------------------
The first rule is what I need help with.
The second rule works to get to the gallery but then you can't go anywhere from there to actually do stuff.
This is an example of a link that I am expecting to work with the first tag:
http://www.example.com/media/gallery/?g2_view=core.SiteAdmin&g2_return=%2Fmedia%2Fgallery23%2F%3Fg2_lery%3D%26g2_view%3Dcore.SiteAdmin%26g2_itemId%3D7%26g2_navId%3Dx16c9aa0b&g2_returnName=site+admin&g2_navId=x16c9aa0b
This should translate to:
http://www.example.com/multimedia.php?gallery&g2_view=core.SiteAdmin&g2_return=%2Fmedia%2Fgallery23%2F%3Fg2_lery%3D%26g2_view%3Dcore.SiteAdmin%26g2_itemId%3D7%26g2_navId%3Dx16c9aa0b&g2_returnName=site+admin&g2_navId=x16c9aa0b
When I manually copy and paste the second link it does work properly, so I know it is with the mod_rewrite section.
Unfortunetly I dont have access to RewriteLog (Shared Hosting)
Help me
Second, regarding your specific problem, MOD_REWRITE doesn't (as far as I know) match the contents of query strings. You can add the entire query string to your results using the $QUERY_STRING variable, so your first rule could be redone something like this (I didn't test this, but if it doesn't work I think you'll get the idea)
RewriteRule ^media/gallery/$ multimedia.php?gallery&$QUERY_STRING
There's also the 'qsappend' flag, which would allow you to "append a query string part of the substitution string to the existing string". I've never used it, but it sounds worth investigating.
Finally, the Apache docs are always good nerd readin'.
posted by alan at 3:07 PM on August 7, 2006