I've got a previous question which was clarified perfectly but requires an amendment and that i was not able to retort and so do produced a brand new question.

I needed a mod_rewrite that made the next:


into this:


but which covered the not compulsory utilization of var2, var3 and var4 therefore if individuals variables were empty, it might still work.

The question was clarified perfectly however it requires an amendment to utilize different area choices for var2, var3 and var4.

The code I've is:

RewriteEngine on
Options +FollowSymlinks -MultiViews

RewriteCond  %{QUERY_STRING} !^page= [NC]
RewriteRule ^([^/]+)/?$ /?page=$1 [L]

RewriteCond  %{QUERY_STRING} !^page= [NC]
RewriteRule ^([^/]+)/([^/]*)/?$ /?page=$1&cat=$2 [L]

RewriteCond  %{QUERY_STRING} !^page= [NC]
RewriteRule ^([^/]+)/([^/]*)/([^/]*)/?$ /?page=$1&cat=$2&subcat=$3 [L]

RewriteCond  %{QUERY_STRING} !^page= [NC]
RewriteRule ^([^/]+)/([^/]*)/([^/]*)/([^/]*)/?$ /?page=$1&cat=$2&subcat=$3&subsubcat=$4 [L]

This works however i require it to have the ability to make an if-or-else for the option of what area has been employed for what variable and also to differentiate.

For instance, as we possess the following two strings normally, you can easily distinguish what area applies to what variable:



however for this string, it takes a chance to distinguish what area the variable is perfect for:


I want the mod_rewrite to select that is getting used.

In addition to this, after i really visit a folder that does exist, it will work properly. For instance, basically visit a folder known as "test", that is a real folder:


it uses it as being a flexible for that "page" area. Basically make use of the following with no finish forward slash:


it results the next in to the URL:


I want results for folders which exist normally also.

Please can someone let me know how you can do this? I'd appreciate any assist in solving this problem.

Also, can someone let me know exactly what the "-MultiViews" bit means at the start when i haven't run into this before?