Apache complex regex crashing with 500 error

Posted by digitalspaghetti on Stack Overflow See other posts from Stack Overflow or by digitalspaghetti
Published on 2010-04-23T13:47:53Z Indexed on 2010/04/23 13:53 UTC
Read the original article Hit count: 380

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about apache

Related posts about regex