Charles Dahab Charles Dahab - 2 months ago 5x
Apache Configuration Question

How to recognize only one parameter - htacess?

I'd like to redirect when has only one parameter, for example:
for the path /game/amazing the user are gonna play the game called amazing, if the user goes to /game/category/action, the user goes to the category action and is gonna see all the action games.
But i do not know how to do this, someone can help me?

RewriteRule ^game/([^/]+) play.php?play=$1 [L,QSA]
RewriteRule ^game/([^/]+)/([^/]+) play.php?category=$1&show=$2 [L,QSA]


You need to use anchor $ in your patterns:

RewriteRule ^game/([^/]+)/?$ play.php?play=$1 [L,QSA,NC]

RewriteRule ^game/category/([^/]+)/?$ play.php?category=$1 [L,QSA,NC]