0

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)

3
  • after you "turned on the module", have you restart Apache ? Commented Nov 4, 2011 at 4:10
  • It's not really under my control, but I know it works because it is working with a different url like I can send requests for details to details.php Commented Nov 4, 2011 at 4:12
  • 2
    as @ShivanRaptor mentioned ensure RewriteEngine On is at the top of your .htaccess file. Commented Nov 4, 2011 at 4:16

2 Answers 2

1

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 "+".

Sign up to request clarification or add additional context in comments.

Comments

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

1 Comment

Thanks for helping me by answering my question. I am voting for you. It's the most I can do here for you :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.