3

I face a problem with URL rewrite in views. In the Re-Write Results section I choose "Output this field as a link" and provide the following link path;

node/[nid]&month=[field_month]

(nid is the node id, field_month is a date field with a special format of 'Y-m')

The relevant URL should be something like this node/39&month=2012-02.

The problem is that Drupal encodes the URL and in response I receive

node/39%26month%3D2012-02, which is unusable. I use Drupal 7.12 and views 7.x-3.1.

Any suggestions how can I overcome this?

  • If you are comfortable with php, you could do this yourself in a views template – Jimajamma Feb 21 '12 at 18:49
  • Since the & and + characters are Reserved characters in a URL, it looks as if Views is automatically translating them to their code equivalents. How will you be using the information in the URL? – Ashlar Feb 21 '12 at 22:10
  • 2
    yeah, are you sure you don't need node/39?month=2012-02 – uwe Feb 22 '12 at 18:11
1

See @MotoTribe's / @Ashlar's comment for a clue. node/1/&foo=bar is not a valid URL. An unescaped & character is only legal in the query portion of the URL, but not the path part. The path and query are separated by the ? character and since your URL doesn't have a ?, the & must be in the path part of your URL. As a result, views automatically escapes it for you.

I suspect you just want node/[nid]?foo=bar. In that case, views will NOT escape the ? or =.

The & character is only used to separate queries when more than one appear in the query section of the URL.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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