1

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 &3F with ?, replace %3D with =

2 Answers 2

2

You need to enable clean URLs. From the documentation:

For Drupal 7:

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

For Drupal 5/6:

  1. Go to the Clean URL's (Administer > Site configuration > Clean URLs in Drupal 5) section of the administrative interface.
  2. 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.

  3. Click on the Run the clean URL test link at the end of the above paragraph.
  4. 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.
2
  • Ok, first thanks for the feedback. Let's assume that I cannot enable Clean URL for now (it caused other strangeness). Can I just bandaid this in code? Commented Feb 24, 2016 at 16:28
  • I don't think so, but I'm not sure. In either case, this is not something I would recommend you doing. I suggest looking into the strangeness caused by clean URLs instead. Commented Feb 24, 2016 at 16:32
0

Have a look at my answer to "How to use the Rules module to implement a custom redirect for an outdated URL?". It explains how you can use the Rules module for al sorts of URL redirect.

Moreover it also includes lots of details about how the Rules URL Argument module may help to get you close to what you're trying to do.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.