I've this url: http://localhost/zina/Artist%20One%20Demo?l=8&m=10&c And it must become: http://localhost/?p=Artist%20One%20Demol=8&m=10&c&option=com_zina&Itemid=82

I'm by using this to rewrite the url:

RewriteRule ^zina/(.*)?(.*)$ /?p=$1&$2&option=com_zina&Itemid=82 [L,R]

However, I find yourself with web addresses that appear to be such as this: http://localhost/?p=Artist%20One%20Demo/Title%20One&&option=com_zina&Itemid=82

In otherwords, $2 isn't being matched up with anything. Can anybody let me know why?

? is really a special character (chooses or one of the previous pattern), .* is greedy (will match so far as sometimes it can go, so before the finish, so $2 will always be empty as $1 eats everything before the finish from the line.

The query string isn't within the string the RewriteRule matches against, and checking for designs within the query string would normally be achieved with RewriteCond %{QUERY_STRING} pattern before a RewriteRule.

However, we don't have to dabble with regexes to obtain the query string within the url:

RewriteRule ^zina/(.*)$ /?p=$1&option=com_zina&Itemid=82 [L,R,QSA]

This really is from the cuff and never examined, however it appears like you aren't getting away your ? within the rewrite regex to ensure that it'll address it literally.

Do this maybe

RewriteRule ^zina/(.*)\?(.*)$ /?p=$1&$2&option=com_zina&Itemid=82 [L,R]