How to Decode the & from a URL so that header() works (urldecode not working)

Viewed 23624

I have the following URL: $url = 'http://mysite.com/?p=welcome&x=1&y=2';

I need to decode it so that header("Location: $url"); actually works.

However, using urldecode($url) is not working because it's not decoding the & -> & and so the browser is getting redirected to http://mysite.com/?p=welcome&x=1&y=2 which fails.

I need it to decode so that it looks like: http://mysite.com/?p=welcome&x=1&y=2

How do I do that?

4 Answers
Related