Page 1 of 1

mod_rewrite (help)

Posted: Sat Jan 20, 2007 3:05 pm
by spamyboy

Code: Select all

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^game-([\d]+).html$ play.php?id=$1
RewriteRule ^sports.html  /index.php?category=1 [L]
RewriteRule ^rss.html  /rss.php [L]
RewriteRule ^action-games.html  /index.php?category=2 [L]
RewriteRule ^board-games.html  /index.php?category=3 [L]
RewriteRule ^adventure-games.html  /index.php?category=4 [L]
RewriteRule ^strategy-games.html  /index.php?category=5 [L]
RewriteRule ^arcade-games.html  /index.php?category=6 [L]
RewriteRule ^shooting-games.html  /index.php?category=7 [L]
RewriteRule ^miscellaneous-games.html  /index.php?category=8 [L]
RewriteRule ^submit-game.html /index.php?go=submit [L]
RewriteRule ^letter-([\d]+).html$ index.php?letter=$1
not realy sure, why for e.g.
game-12.html works
and letter-a.html doesnt work, why ?

Posted: Sat Jan 20, 2007 3:13 pm
by John Cartwright
\d for digits only :wink:, thats why it fails when trying to match the letter "a"

Posted: Sat Jan 20, 2007 3:15 pm
by spamyboy
wo what should I use for numbers ?
edited:

Code: Select all

([a-zA-Z0-9\-_\.\/]+)
thank's for your time :)

Posted: Sat Jan 20, 2007 3:17 pm
by John Cartwright
spamyboy wrote:wo what should I use for numbers ?
For letters you mean? I think its time you read viewtopic.php?t=33147 :)

Posted: Sat Jan 20, 2007 3:23 pm
by spamyboy

Code: Select all

RewriteRule ^letter-([a-zA-Z]+).html$ index.php?letter=$1
...

Posted: Sat Jan 20, 2007 3:28 pm
by m3mn0n
I recommend you should pass the flags [QSA, L] for all those rules.

Posted: Sat Jan 20, 2007 3:30 pm
by John Cartwright
spamyboy wrote:

Code: Select all

RewriteRule ^letter-([a-zA-Z]+).html$ index.php?letter=$1
...
I don't get what your saying.

So you actually are asking what to use for numbers? I already told you that.

Posted: Sat Jan 20, 2007 3:34 pm
by spamyboy
My point is that I allready made it work...

Posted: Sat Jan 20, 2007 3:34 pm
by m3mn0n
Moving this to the Installation and Configuration forum.