htaccess help

i want do rewriterule and redirect for my website

all my pages was index.asp now (index.php) and the category was sent as querystring like that

index?cat=1&type=1
index?cat=2&type=1
index?cat=3&type=2

now i did that

RewriteRule ^cars$ index.php [QSA,L]
RewriteRule ^mobiles$ index.php [QSA,L]

so anyone type http://myweb.com/cars he opens http://mydomain.com/index.pph and i set the category in my php file depending to str_replace("/","",$_SERVER[‘REQUEST_URI’]) if its cars then cat = 1 if its mobiles then cat = 2 and so … the type querystring not important

all that work fine but i have some problems

in the index.php i have paging script page 1 . 2 next …

so the url looks like that

http://www.mydomain.com/index.php?pageid=1&cityid=1&type=1&iss=4&searchid=&model=2&yearto=0&yearfrom=0

now with this parameter [QSA] the querystring sent but if i clicked in the next page the new querystring appended to the old querystring not replacing the old one

if i removed [QSA] or add the “?” to the end of destination page there no querystring or it seems thet the querystring sent but the php can’t handle it

i tried index.php(.*)$ index.php$1 that didn’t work

i tried RewriteCond %{QUERY_STRING} ^(.*)$ and index.php%1

that didn’t work too

note the the important problem that the link my came from old asp page from google so it may look like that
http://www.mydomain.com/index.php?pageid=1&cityid=1&type=1&iss=4&searchid=&model=2&yearto=0&yearfrom=0

asp not php

all what i need to do is

1- if anyone type index.php or index.asp (without querystring) opens domain.com and change the addressbar
2- if anyone type index.asp? and querystring, opens to domain.com/(cat) depending on the cat= sent by querystring if that not possible then opens index.php? + querystring with changing the addressbar
3- if anyone type index.php? and querystring then opens to domain.com/(cat) depending on the cat= sent by querystring with changing the addressbar
4- if anyone type domain.com/cars … mobile … etc opens index.php without changing the addressbar
5- the way to check in RewriteCond if there is any querystring sent with page anyquerystring if true then rwriterule else skip 1

thank you very much

Sponsor our Newsletter | Privacy Policy | Terms of Service