Charles Dahab Charles Dahab - 1 year ago 186
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]

Answer Source

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]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download