apache - Trouble with mod_rewrite and 2 parameters -


i use url's on website in form www.x.com/cat/prod

first have www.x.com/cat/prod pass www.x.com/index.php?cat=cat&prod=prod , managed this:

rewritecond %{request_filename} !-s  rewritecond %{request_filename} !-l  rewritecond %{request_filename} !-d rewritecond $1 !\.(js|ico|gif|jpg|png|css|html|swf)$ rewriterule ^(.*)/(.*)/?$ index.php?cat=$1&prod=$2 [b,qsa,l] 

secondly have if accessed www.x.com/index.php?cat=cat&prod=pro should 301 redirected www.x.com/cat/prod , used this:

rewritecond %{the_request} ^get\s/+index\.php [nc] rewritecond %{query_string} (^|&|\?)cat=(.*)&prod=(.*)($) [nc] rewriterule . /%2/%3? [r=301,l,nc] 

the problem gives me www.x.com/cat&prod=prod instead of www.x.com/cat/prod, tried lot of things found around here still can't manage right.

any advice appreciated.

have this:

rewriteengine on  rewritecond %{the_request} \s/+index\.php\?cat=([^&]+)&prod=([^&\s]+) [nc] rewriterule ^ /%1/%2? [r=301,l]  rewritecond %{request_filename} !-s  rewritecond %{request_filename} !-l  rewritecond %{request_filename} !-d rewritecond $1 !\.(js|ico|gif|jpg|png|css|html|swf)$ rewriterule ^([^/]+)/([^/]+)/?$ /index.php?cat=$1&prod=$2 [b,qsa,l] 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -