mod_rewrite (help)

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

mod_rewrite (help)

Post 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 ?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

\d for digits only :wink:, thats why it fails when trying to match the letter "a"
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post by spamyboy »

wo what should I use for numbers ?
edited:

Code: Select all

([a-zA-Z0-9\-_\.\/]+)
thank's for your time :)
Last edited by spamyboy on Sat Jan 20, 2007 3:17 pm, edited 1 time in total.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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 :)
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post by spamyboy »

Code: Select all

RewriteRule ^letter-([a-zA-Z]+).html$ index.php?letter=$1
...
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

I recommend you should pass the flags [QSA, L] for all those rules.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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.
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post by spamyboy »

My point is that I allready made it work...
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Moving this to the Installation and Configuration forum.
Post Reply