How to replace URL fragments? I suppose this is more of a PHP question.

I'm trying to work on some redirects that's outputting:

http://localhost/mysite/?q=node/add/cmsdeliverable%3Ffield_demo_id_reference%3D1208

But what I need is this:

http://localhost/mysite/node/add/cmsdeliverable?field_demo_id_reference=1208
How can I cut the ?q=, and replace the &amp;3F with ?, replace %3D with =
You need to enable clean URLs. From the documentation:

For Drupal 7:


Navigate to the Clean URLs configuration page (Administer > Configuration > Search and metadata > Clean URLs)
Wait for the automated Clean URLs test to run.
Check or uncheck the Enable clean URLs checkbox
Click "Save configuration"


For Drupal 5/6:


Go to the Clean URL's (Administer > Site configuration > Clean URLs in Drupal 5) section of the administrative interface.
Look for the paragraph that reads as follows:  


  This option makes Drupal emit "clean" URLs (i.e. without ?q= in the URL.) Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The handbook page on Clean URLs has additional troubleshooting information. Run the clean URL test.

Click on the Run the clean URL test link at the end of the above paragraph.
If the test is successful, set Clean URLs to "enabled" and save the configuration. If the test is not successful, use the steps below to fix your server configuration and try again.