Hi,
Is there any way that using redirect.json we can redirect a URL to another external URL?
for example:
I want to sitedomain.com/yt to redirect to “anothersite.com/something”
Not sure that you can use redirect.json, this is a workaround script on code injection on page/post window.location.href = "http://www.example.com";
Yes, here’s a thread with a list of different examples:
Thanks, But I tried it, it’s not working…
I used it like this:
[{
“from”: “/youtube/” ,
“to”: “/Moeen - YouTube”,
“permanent”: true
}]
The to
url should look like this:
"to": "https://youtube.com/channel/..."
- no preceding /
or $1
btw, when you’re pasting config files, if you surround them with 3 backticks, it’ll be easier for other people to read
e.g.:
```
[{
}]
```
Thanks a lot, I also tried that, but with out those also not working,
my redirect is like this:
[{“from”:“/youtube/”,“to”:“https://youtube.com/channel/UCtEVbIj5ZkmUTM2n272xu8Q","permanent”:true}]
but it goes to a URL like this:
https://moeen.salehi.pw/https:/youtube.com/channel/uctevbij5zkmutm2n272xu8q/
Does this happen in incognito as well? If you tried with an incorrect redirect, sometimes your browser will remember for a few hours
No in incognito it’s ok, thanks for the input.
Using the YAML file, you can do this as follows:
301:
/url-goes-here : https://redirect-goes-here.com
Example:
Note: If you use a “/” in front of the URL you’re redirecting too, it will cause a 404 error, as Ghost will go to “yourdomain.com/https://redirect-goes-here.com” instead of the domain itself.