Link breaks when target URL ends in slash | Community
Skip to main content
April 19, 2018
Question

Link breaks when target URL ends in slash

  • April 19, 2018
  • 1 reply
  • 3436 views

I recently relaunched a website and we're encountering some issues with links from Marketo back to URLs on the website. We've created a set of redirect rules using Regular Expressions which has worked well except for instances where the URL ends in a slash '/'.

It seems Marketo is inserting a '?' before the querystring when a URL ends in a character other than a slash, which is great, but if there's a '/' at the end, no slash. In this case, the URL structure looks like a deeper directory and my website throws a 404.

For example,

These work:

www.mysite.com/a-really-cool-destintion/?mkt_tok=1234

www.mysite.com/a-really-cool-destintion?mkt_tok=1234

This does not:

www.mysite.com/a-really-cool-destintion/mkt_tok=1234

The problem I have is that about 50% of links form Marketo point back to my website are URLs ending in a '/'.

Is there a way to force the use of a '?' before 'mkt_tok' ?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
Level 10
April 19, 2018

Unless a bug has recently been introduced, this should work fine.

Let's look more deeply at what you're doing. Please post the original HTML (just relevant snippet of course) with the link and then the rewritten link at your tracking server.

April 19, 2018

Thanks Sanford. We just determined the issue and it actually has to do with our redirect rules. Marketo is actually inserting and & in there.

The original URL in Marketo has a structure like this

www.mysite.com/a-really-cool-destination.asp?s=video1.mp4

The new site URL is built like this

www.mysite.com/a-really-cool-destination-video1/

Marketo sees the existing ? and then appends the querystring to preface with &. When it gets to my site, this is happening:

www.mysite.com/a-really-cool-destination-video1/&mkt_tok=1234

This causes a 404.

I'm going to just append my redirect rule so that for these pages it'll end in '/?'

Thanks for looking to help!