Forum Moderators: phranque
how can i have the rewrite functions work for the main script while not affecting the one subdirectory containing the blog?
RewriteRule ^album/(.*)\.html$ albums.php?album=$1 [L,NC]
RewriteRule ^album/(.*)/([0-9]*)$ albums.php?album=$1&page=$2 [L,NC]
RewriteRule ^([a-zA-Z0-9]*)/$ lyrics.php?letter=$1 [L,NC]
RewriteRule ^([a-zA-Z0-9]*)/([0-9]*)$ lyrics.php?letter=$1&page=$2 [L,NC]
RewriteRule ^lyrics/([0-9]*)/(.*)\.html$ viewlyrics.php?id=$1&title=$2 [L,NC]
RewriteRule ^singer/(.*)\.html$ singer.php?singer=$1 [L,NC]
RewriteRule ^singer/(.*)/([0-9]*)$ singer.php?singer=$1&page=$2 [L,NC]
the directory I do not want affected by this rewrite is
musicblog
Alternatively, put a 'skip' rule ahead of your existing rules, to skip them all if a blog request is detected.
The most-specific solution will cause the least pain over time, so do not choose the 'easy way' over the 'right way.'
Also, once you have the major problem sorted, please post back, as your existing rules could do with some improvements...
Jim
i have no clue how to write a skip rule
the two lines that are interfering are
RewriteRule ^([a-zA-Z0-9]*)/$ lyrics.php?letter=$1 [L,NC]
RewriteRule ^([a-zA-Z0-9]*)/([0-9]*)$ lyrics.php?letter=$1&page=$2 [L,NC]
i am assuming that the coding ([a-zA-Z0-o]) is what is doing the rewrite for everything, including my subdirectory/
I just cannot figure out how to modify that to not rewrite the specific subdirectory
# Skip next two rules if request is for anything in the '/subdirectory/' path
RewriteRule ^subdirectory/ - [S=2]
RewriteRule ^([a-z0-9]+)/$ lyrics.php?letter=$1 [NC,L]
RewriteRule ^([a-z0-9]+)/([0-9]+)$ lyrics.php?letter=$1&page=$2 [NC,L]
Jim
Note however, that using "[^.]+" means that the matched string must/will not contain any periods, and that "[^/]+" means that the matched string must/will not contain any slashes. So don't use this if, for example, your 'artist' name might be "R.E.M."
However, even in that case, you'd do well to replace the "*" with "+" unless you want to allow the parameter to be completely-blank.
Jim