mod_rewrite different rules for different pages
- by Sophia Gavish
Hi,
I'm trying to understand how mod_rewrite works. I've been using it before but this week I tried to write rules to a new website and it doesn't works.
I want to make a rule to make : www.example.com/media/?gallery=galleryname&album=albumname&pid=pictureid
looks like: www.example.com/media/galleryname/albumname/pictureid
The rule is: RewriteRule ^([^/])/([^/])/([^/]*)$ /media/?gallery=$1&album=$2&pid=$3 [L]
and here is the code below:
Options -Indexes Options
+FollowSymLinks
RewriteEngine on RewriteBase /
RewriteCond %{REQUEST_METHOD}
!^(TRACE|TRACK|GET|POST|HEAD)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([^/])/([^/])/([^/]*)$ /media/?gallery=$1&album=$2&pid=$3 [L]
I really want to know what I'm missing, because I tried some examples and it looks fine to me. maybe because /media/ is an actual folder the rule is wrong?
Thanks.