mod_rewrite, cataching exceptions

Is there a better way to structure these rewrite rules?


RewriteEngine On
RewriteRule ^users$ users_overview.php
RewriteRule ^users/$ users_overview.php
RewriteRule ^users/[0-9]?$ users_overview.php?customer=$1 [NC,L]
RewriteRule ^users/([^/\.]+)/?$ users_overview.php?customer=$1 [NC,L]
RewriteRule ^users/([^/\.]+)/([^/\.]+)?$ users_overview.php?customer=$1&pageno=$2 [NC,L]
RewriteRule ^users/([^/\.]+)/([^/\.]+)/?$ users_overview.php?customer=$1&pageno=$2 [NC,L]

Open in new window

LVL 1
krv123Asked:
Who is Participating?
 
David S.Connect With a Mentor Commented:
Try this:
RewriteEngine On
RewriteRule ^users/?$ users_overview.php
RewriteRule ^users/([^/\.]+)/?$ users_overview.php?customer=$1 [NC,L]
RewriteRule ^users/([^/\.]+)/(([^/\.]+)/?)?$ users_overview.php?customer=$1&pageno=$3 [NC,L]

Open in new window

0
 
krv123Author Commented:
Will it catch any forward slashes?
0
 
krv123Author Commented:
correction if there are not any forward slashes
0
 
krv123Author Commented:
it works thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.