Re: Link breaks when target URL ends in slash

Anonymous
Not applicable

Link breaks when target URL ends in slash

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' ?

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Link breaks when target URL ends in slash

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.

Anonymous
Not applicable

Re: Link breaks when target URL ends in slash

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!

Anonymous
Not applicable

Re: Link breaks when target URL ends in slash

I'm having a similar issue in that Marketo is adding a forward slash / to the end of my url's that end in .html and before my utm tracking...

This is forcing my site to 404...

Link should look like: ".....service-releases.html?utm_source=......."

Marketo is forcing this: "....service-releases.html/?utm_source=....." which is causing a 404

Is this a Marketo issue or issue with my site setup?

SanfordWhiteman
Level 10 - Community Moderator

Re: Link breaks when target URL ends in slash

Marketo doesn't add trailing slashes to URLs that end in .html.

This has to be happening on your webserver.