views:

34

answers:

1

Hi Guys,

I was wondering if you could advise if there is a more efficient way of writing what I have below? Could this be acheived in the 1 rule?

RewriteRule ^search/(cars|boats|plant)/([-a-zA-Z0-9]+)/type-([0-9]+)/price-([0-9]+)-([0-9]+)/?$ search.php?category=$1&location=$2&type=$3&minprice=$4&maxprice=$5 [L]
RewriteRule ^search/(cars|boats|plant)/([-a-zA-Z0-9]+)/type-([0-9]+)/?$ search.php?category=$1&location=$2&type=$3 [L]
RewriteRule ^search/(cars|boats|plant)/([-a-zA-Z0-9]+)/?$ search.php?category=$1&location=$2 [L]
RewriteRule ^search/(cars|boats|plant)/?$ search.php?category=$1 [L]

Also, I am having difficulty obtaining a friendly URL after a form is submitted. Any ideas how to do this?

Thanks!

+1  A: 

Perhaps you'd be better off just writing one rule to redirect from /search to search.php, and then parsing the rest of the URI there? (I.e. redirect to search.php?q=REST_OF_URI_GOES_HERE)

Amber
Hi Dav,Thanks for your reply. Im not too sure how this would work? Ok, so if I redirect /search to search.php and parse the URL to get the variables passed, do I redirect to friendly URL using php?Ho would the friendly URLs work without the rewrite rules?Thanks
drs
Friendly URLs on the pages, or in the address bar? You should be able to use friendly URLs on the pages already (that's why you have the rewrite, after all).
Amber