Hello,

When I add the following page to be redirected:
?p

I have a question mark added to the end.

For example: http://www.yoursite.com/?p= when I asked it to be the page http://www.yoursite.com/?p

How do I go about redirecting just a ?p page?

Comments

pkahleeb’s picture

Title: Question Mark added to some URL's » Equal Sign added to some URL's

I posted this when I was half asleep and originally said that a question Mark was being added to the end of URLs. It is, in fact, an Equal Sign.

dscl’s picture

@pkahleeb
Could you please describe it better? I didn't get what exactly is happening...

Is it one of the following?

(1) When you try to add a new redirect from "abc" to "?p", the module is creating a redirect from "abc" to "?p=";
(2) When you try to add a new redirect from "abc" to "?p", the module seem to create a redirect from "abc" to "?p". But when you use it, the "=" is added to the end of the destination URL;
(3) When you try to add a new redirect from "?p" to "abc", the module is creating a redirect from "?p=" to "abc".

Cheers!

pkahleeb’s picture

Sorry for all the confusion. The 3rd describes the issue.

(3) When you try to add a new redirect from "?p" to "abc", the module is
creating a redirect from "?p=" to "abc".

pkahleeb’s picture

pkahleeb’s picture

dscl’s picture

Priority: Critical » Normal
Status: Active » Closed (works as designed)

@pkahleeb

My question make no sense at all.

Actually, the path_redirect module was not supposed to allow you to create such redirect since "?p", by definition, is simply a query string and should not be considered a path.
By default the path_redirect will remove the quotation mark and create a redirect from "p" to "abc".
So I couldn't reproduce what you said.

But I've tried another way and than I saw it happening.
What I did was to add a redirect from "something?p" to "abc"...
Then I saw that the added redirect was actually from "something?p=" to "abc".

I took a look at the code and I saw that the issue is actually related to a Drupal core function called "drupal_query_string_encode" which is responsible for treating any query string that is added to the redirect source.

What happens is that this function expects a value for each parameter passed in the query string, so since the "p" have no value set, the function add only the "=" in the end.

So it shouldn't be considered a bug for this module, but for the core function.
I believe patching this in the module would be an workaround and is not the best approach for doing it.
I've opened an issue for the Drupal core function ( drupal.org/node/1968080 ), so you can follow it and I'll close this one here.

For now, I suggest you to use the mod_rewrite for Apache to handle this specific redirect.

Cheers!