mod_rewrite different rules for different pages
Posted
by Sophia Gavish
on Stack Overflow
See other posts from Stack Overflow
or by Sophia Gavish
Published on 2010-04-22T17:10:51Z
Indexed on
2010/04/22
17:13 UTC
Read the original article
Hit count: 286
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.
© Stack Overflow or respective owner