0
RewriteRule    ^list     lists.php [NC]
RewriteRule    ^list/([^-]+)/     lists.php?listid=$1 [NC]

The problem is even if the link is like example.com/list/5 it is directed to list.php without the value. The second condition is not getting satisfied ever. How to solve this?

Sarvap Praharanayuthan
  • 4,212
  • 7
  • 47
  • 72
  • 1
    very helpful http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html from http://stackoverflow.com/questions/16388959/url-rewriting-with-php – ajt Aug 14 '13 at 09:39

1 Answers1

2

Try

RewriteRule ^list$     lists.php [L]
RewriteRule ^list/([\d]+)/$     lists.php?listid=$1 [L]

Notice that it will match list/5/ but not list/5. That would be:

RewriteRule ^list/([\d]+)$     lists.php?listid=$1 [L]

Edit: You can use [NC] if you want... I personally like the [L] flag and the case wording respected.

The Marlboro Man
  • 971
  • 7
  • 22