I need to ModRewrite this index.php?v=$1&s=$2&p=$3&c=$4 I know this one would do RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/page([^/\.]+)/([A-Za-z0-9-]+)/?.html$ index.php?v=$1&s=$2&p=$3&c=$4 [N] (www.example.com/view/show/page1/category.html) But by problem is the variables v, s, p and c are NOT REQUIRED to be always present. So using the mod rewite above will treat the following www.example.com/show as www.example.com/index.php?v=$1 while it should be www.example.com/index.php?s=$1 OR www.example.com/page1/category.html as www.example.com/index.php?v=$1&s=$2 while it should be www.example.com/index.php?p=$1&c=$2 How can I resolve this? Thanks