regex - Need help with mod_rewrite conditions -


probably simple thing i'm not sure do: have in htaccess file far

rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d #rewriterule ^([^/]*)/?([^/]*)/?([^/]*)/?$  x.php?country=$1&province=$2&region=$3&xxx=zzz [skip=1] rewriterule ^([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?$  defaultgg.php?country=$1&province=$2&region=$3&category=$4&type=$5&prodid=$6 [l] 

and redirection well. need add part says redirect different page if of last 3 parameters set. tried l , skip options don't seem work skip later rules final rule (shown above) gets run.

the idea if enters url http://dddd.com/ca/on/peel go defaultgg... shown.

else if enters url http://dddd.com/ca/on/peel/veggies/tomatoes go page x listing tomatoes in city of peel.

else -- if enters url http://dddd.com/ca/on/peel/veggies/any go page y listing veggies in city of peel.

else -- if enters url http://dddd.com/ca/on/peel/veggies/prodid go page y list details of prod prodid found in veggies in peel.

how set rules?

thanks

ps: else -- if enters url http://dddd.com/ca/on/peel/veggies go page defaultgg above categories set "veggies", use of keyword "any" in url 4th, 5th or 6th url folders cause search done in script y, leaving 1 off entirely direct towards defaultgg. suppose use of word "any" trigger search if occurs anywhere in url folder.

i making headway this:

rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !/any[/]* #go defaultgg narrrow search rewriterule ^([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?$  defaultgg.php?aa=$1&bb=$2&cc=$3&dd=$4&ee=$5&xxx=aaa  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # search rewriterule ^([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?$  index.php?file=searchresult&aa=$1&bb=$2&cc=$3&dd=$4&ee=$5&ff=$6&xxx=zzz 

i working witha legacy smarty based website , trying add freindly url support. in site goes through index.php various parameteres hence awkward file=searchresult stuff. maybe instead of using defaultgg.php roll index.php defaultgg.php might become index.php?file=defaultgg etc.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -