0

I have a content type which uses the link field which I have set to external URLs only. When I put a website URL with more than 1 query in it, it won't render the second portion of the query at all.

Example of what should render:

https://example.com/login.aspx?inst=name&url=http://example2.com/PlayLists.aspx?aid=8674

Ends up rendering as:

https://example.com/login.aspx?inst=name&url=http://example2.com/PlayLists.aspx

Removing the last ?aid=8674

I've tried setting the field setting to use Both internal and external links as mentioned in this similar question, however, this did not solve anything for me. Any time there is more than 1 query with the URL, it removes everything except the first one.

Would anyone have come across this before or know of a way to solve this? For this particular content type, we link users to external sites and they need these URL's to authenticate through the multiple parameters we set in the link field.

  • This is not a valid URL. You have to encode it, google for "URL encoder" – Hudri Jul 30 '19 at 20:13
  • Why is it not a valid URL? I have manually created over 100 nodes with these URL's. I don't want to have to go back into each one and fix the URL's to their "encoded" versions. Plus, I just tested one and when I do that, the link doesn't actually work anyway as I get a 404 error. – ACanadianCoder Jul 30 '19 at 20:41
  • The value of url your parameter contains not allowed characters, e.g. the question mark. You have to encode the special characters to use them in an URL string – Hudri Jul 31 '19 at 5:33
  • Ok I’ll test this out but why is the first question mark allowed but not a second? I find that aspect strange. – ACanadianCoder Jul 31 '19 at 11:56
  • Since I was displaying my content with views, I used the rewrite results of the field_link field to {{ field_link__uri }} to show the RAW uri and used a custom text field to place the raw uri in an anchor tag and it fixed my problems. – ACanadianCoder Jul 31 '19 at 14:38

Your Answer

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

Browse other questions tagged or ask your own question.