Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • burgi 16 posts 98 karma points
    Nov 24, 2017 @ 15:53
    burgi
    0

    Redirect Adding a Trailing Slash

    I have added a redirect to the UrlRewriting.config file but I am getting some weird behaviour when I test it. I have a custom URL that is redirecting to a totally separate domain that we do not control.

    The rule is:

    <add name="customrewrite166" redirect="Domain" virtualUrl="^http\://(.*)/vanityurl/" destinationUrl="http://example.com/sites/default/files/filename.pdf" ignoreCase="true" redirectMode="Permanent" rewriteUrlParameter="ExcludeFromClientQueryString" />
    

    However it is redirecting me to http://example.com/sites/default/files/filename.pdf/ (which is a 404) instead of http://example.com/sites/default/files/filename.pdf.

    What I need to happen is if an end user types in http://test.com/vanityurl or http://test.com/vanityurl/ they end up at the PDF in the rule.

    I think I might have missed something in my regex, but I'm not sure what. Any suggestions?

  • Ben Palmer 176 posts 842 karma points c-trib
    Nov 24, 2017 @ 19:15
    Ben Palmer
    0

    Hi burgi,

    Do you have any rules in your web.config that add the trailing slash? Maybe worth checking and if it's present, negating it for files.

  • burgi 16 posts 98 karma points
    Nov 27, 2017 @ 10:04
    burgi
    0

    Hi Ben

    I had a look through the web.config but I can't see anything that could be adding the slash.

    I think it is copying the redirect string and appending it to the destination URL which is leading me to believe it is my regex that isn't quite right.

Please Sign in or register to post replies

Write your reply to:

Draft