使用htaccess的呼叫页面

I have htaccess file and this is in it:

RewriteEngine On
Options +FollowSymlinks
RewriteBase /project/

RewriteRule ^betNow/$ index.php?action=betNow [L]
RewriteRule ^(.*)/betNow/$ index.php?action=betNow [L]
RewriteRule ^(.*)/betNow/([0-9]+)$ index.php?action=betNow&id=$2 [L]

and it works, when I type localhost/project/betNow/ but I can't figure out last rule I tried with localhost/project/betNow/4 and localhost/project/betNow/id=4 and that's not working. what am I doing wrong?

Thanks in advance

You have defined your RewriteBase /project/ and your site apparently resides in http://localhost/project/ - so when you call http://localhost/project/betNow/ the request string handed over to the rewrite rules is just betNow/.

Therefor your rules starting with ^(.*)/betNow will not match. You just need:

RewriteRule ^betNow/$ index.php?action=betNow [L]
RewriteRule ^betNow/([0-9]+)$ index.php?action=betNow&id=$2 [L]

And you can use

http://localhost/project/betNow/  --> index.php?action=betNow
http://localhost/project/betNow/4 --> index.php?action=betNow&id=4

Shouldn't the rules be

RewriteEngine On
Options +FollowSymlinks
RewriteBase /project/

RewriteRule ^betNow/$ index.php?action=betNow [L]
RewriteRule ^betNow/([0-9]+)$ index.php?action=betNow&id=$2 [L]

You may need to put a / after both of the ^ characters in the rewrite rules too

Instead of localhost/project/betNow/id=4 try: localhost/project/betNow/id/4

And use:

RewriteRule ^(.*)/betNow/id/([0-9]+)$ index.php?action=betNow&id=$2 [L]