Hello Guyz,

I could not found any Forum for Web Servers or something related to my problem so I am posting it here.

So I am having trouble with Regular Expressions in HTACCESS.

So what I have in my website is :
ROOT : (my web root is in a sub folder 'sites')
/sites/index.php and other files
/sites/sites/sample_folder_name/index.php and other files

Now what I would like to do is to ReWrite URL :
to :

Remember :
If the URL contains any Request Parameters, then those must also be rewrited, i.e :
Example :
to :

Currently, the rewrite is working great but I am not able to make them work with parameters.

What I have in my HTACCESS right now :

RewriteRule ^sites\/([0-9A-Za-z_]+)\/([0-9A-Za-z_]+)\.php(.*)$ $2.php(?(?=$3)$3&)siteredirect=$1 [L]
RewriteRule ^sites\/([0-9A-Za-z_]+)\/$ index.php?siteredirect=$1 [L]

Can anyone make it to work with parameters ? Please help !

Thank You

Ankur Thakur