views:

26

answers:

1

I have been working with an existing website out company has running until I finish developing the new site.

I've been asked to add some additional functionality to booking pages that will automatically set a booking button based on passed parameters.

The existing working regex is as follows:

RewriteRule ^.+-(\d+)\.accommodation$ property_detail.php?id=$1

Which works fine with the url like below and passes through the URL.

this-is-the-property-name.1234.accomodation

However as a quick shiv, I am trying to do the following:

this-is-the-property-name.1234.accomodation?override=true&start_date=2010-05-14&numbernights=2&sleeps=10&price=1012

The regex I came up with for this was:

RewriteRule ^.+-(\d+)\.accommodation\?override=(\w+)&start_date=(19|20)[0-9]{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])&numbernights=(\d+)&sleeps=(\d+)&price=(\d+)$ property_detail.php?id=$1&override=$2&start_date=$3-$4-$5&numbernights=$6&sleeps=$7&price=$8

The regex is passing as valid in RegexBuddy - however it keeps causing a 500 error on the server. Can anyone help me get my head around this one?

A: 

You could just use the first rewrite and append the query string with the [QSA] flag:

RewriteRule ^.+-(\d+)\.accommodation$ property_detail.php?id=$1 [QSA]

adam
Brilliant answer! Seems to work right away, I can see the variables now. I'd vote up, but I don't have enough repuation yet :(
tanepiper
Glad you're happy - accept it if the answer if you're satisfied. Thanks!
adam