Alex
Alex

Reputation: 55

URL Rewriting with two URL parameters

I am attempting URL Rewriting for a URL with two get parameters, I want to covert a page:

status/mystatus.php?=reference=1234&postcode=LL1+LL2

Into:

status/1234/LL1+LL2

I have tried using the following code:

RewriteRule ^status/([a-z0-9A-Z]+)/([a-z0-9A-Z]+)$ status/mystatus.php?reference=$1&postcode=$2 [NC,L]

But it doesn't seem to be working, so what am I doing wrong? (The module is turned on, I am using Apache)

Upvotes: 0

Views: 79

Answers (2)

Jhourlad Estrella
Jhourlad Estrella

Reputation: 3670

RewriteRule ^status/(.*)/(.*)+(.*)

Upvotes: 1

Jon Lin
Jon Lin

Reputation: 143856

Try changing the expressions inside the parentheses to [^/]+ so it looks like:

RewriteRule ^status/([^/]+)/([^/]+)$ status/mystatus.php?reference=$1&postcode=$2 [NC,L]

Because [a-z0-9A-Z] won't match things like "+".

Upvotes: 1

Related Questions