Probably a simple thing but I'm not sure what to do: I have this in my htaccess file so far
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^([^/]*)/?([^/]*)/?([^/]*)/?$ X.php?country=$1&province=$2®ion=$3&xxx=ZZZ [skip=1]
RewriteRule ^([^/]*)/?([^/]*)/?(开发者_StackOverflow[^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?$ defaultgg.php?country=$1&province=$2®ion=$3&category=$4&type=$5&prodid=$6 [L]
And it does the redirection well. But now I need to add a part that says to redirect to a different page if any of the last 3 parameters are set. I tried the L and skip options but they don't seem to work to skip later rules so my final rule (shown above) always gets run.
The idea is if someone enters a url like so http://dddd.com/ca/on/peel then they go to defaultgg... as shown.
ELSE if someone enters a url like so http://dddd.com/ca/on/peel/veggies/tomatoes then they go to a page X listing all tomatoes in the city of Peel.
Else -- if someone enters a url like so http://dddd.com/ca/on/peel/veggies/any then they go to a page Y listing all veggies in the city of Peel.
Else -- if someone enters a url like so http://dddd.com/ca/on/peel/veggies/prodid then they go to a page Y list details of prod with prodid found in veggies in Peel.
How do I set the rules?
Thanks
PS: Else -- if someone enters a url like so http://dddd.com/ca/on/peel/veggies then they go to a page defaultgg as above with categories set to "veggies", so generally then the use of the keyword "any" in the url for the 4th, 5th or 6th url folders will cause a search to be done in script Y, but leaving one off entirely will direct towards defaultgg. I suppose use of the word "any" could trigger a search if it occurs anywhere in the url as a folder.
I am making some headway with this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/any[/]*
#go to defaultgg to 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
# do a search
RewriteRule ^([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?$ index.php?file=searchresult&aa=$1&bb=$2&cc=$3&dd=$4&ee=$5&ff=$6&xxx=zzz
I am working witha a legacy smarty based website and am trying to add freindly url support. Everything in the site now goes through index.php with various parameteres hence the awkward file=searchresult stuff. Maybe instead of using defaultgg.php I could roll it into index.php so defaultgg.php might become index.php?file=defaultgg etc.
精彩评论