UrlTracker icon indicating copy to clipboard operation
UrlTracker copied to clipboard

Double Slashes at the start of the path when redirecting to an absolute url

Open ProNotion opened this issue 7 years ago • 6 comments

When creating a redirect to an absolute url e.g /old-url to http://example.com/new-url you end up with the path beginning with // and so get a final url of http://example.com//new-url which causes issues.

I've patched it and will submit a pull request shortly.

ProNotion avatar Dec 19 '17 10:12 ProNotion

Fab, thanks.

I'll try and take a look during/after Christmas, ensure everything works okay still and deploy in the New Year :)

daniel-chenery avatar Dec 19 '17 11:12 daniel-chenery

No worries, I'm having to use a custom build for now.

ProNotion avatar Dec 19 '17 11:12 ProNotion

@ProNotion I've tried to replicate this before pulling in your request, but I can't replicate it to ensure your fix will work. Perhaps I'm missing a step?

I've done the following Old URL: http://www.example.com/old-page/ New URL: http://www.example.com/new-page/

Upon save, the domain gets removed from the old URL, converting it to a relative URL. Navigating to /old-page/, will take me to /new-page/

daniel-chenery avatar Dec 27 '17 08:12 daniel-chenery

Hi Daniel,

Sorry I should have been clearer. The absolute url would be for an external address. So if my site domain was http://www.example.com/ and my old url was /old-url/ and the redirect was to http://www.anotherdomain.com/new-url/ this is where the problem occurs.

ProNotion avatar Dec 29 '17 13:12 ProNotion

Hi,

I'm afraid I still can't replicate your issue.

This is exactly how I have the redirect in Umbraco at the moment image

And rightly enough, going to localhost/external-url/ will redirect me, with no extra slashes.

Is this how your setup is? Do let me know if I've missed something.

I'm using UrlTracker 3.14.1, and Umbraco 7.7.6

daniel-chenery avatar Dec 31 '17 08:12 daniel-chenery

@daniel-chenery Try leaving the trailing slash off of your redirect url and adding a querystring value something like this:

image

ProNotion avatar May 29 '18 14:05 ProNotion