views:

10

answers:

1

I have a php script that takes in five variables from the url string like this:

/dimg.php?s=250x250&tc=0-0-0&bc=204-204-204&type=jpg&t=blahText

The only required variable is s. The script defaults if all the others are not set.

My question is how do i get the url to look like this with mod_rewrite:

/dimg/250x250/0-0-0/204-204-204/jpg/blahText

Also the 0-0-0 OR 204-204-204 could be 000000 OR CCCCCC OR CCC (RGB or HEX values for colors)

But remember that the only required variable is s so the url COULD look like this:

/dimg/250x250

A: 

what you would need to do is rewrite the whole string to a single variable like this:

/dimg.php?values=250x250/0-0-0/204-204-204/jpg/blahText

you could then split the values by the '/' and then try and match each part using regular expressions.

the other option would be to pair the names and values like this:

/dimg/s/250x250/tc/0-0-0/bc/204-204-204/type/jpg/t/blahText

You could then use the rewrite.

Josh