potato
August 2, 2020, 8:52pm
1
I’m interested in redirecting from the default route (“/”) ONLY if there is a path. Is this possible?
Desired behavior:
User tries to go to ‘https://sophonaut.com ’ and they land on ‘sophonaut.com ’ which is a static site.
User tries to go to ‘Swarmwise ’ and they land on ‘Swarmwise ’
Current attempt was adding this:
[[redirects]]
from = "/*"
to = "https://blog.sophonaut.com/:splat"
status = 301
force = false
The obvious problem with this is that EVERYTHING redirects. This makes sense, but how can I achieve the desired behavior?
Scott
August 2, 2020, 9:53pm
2
You could add a rule above your rule which ensures that traffic to your homepage lands on your homepage. I haven’t tried this – hopefully it doesn’t create a redirect loop!
[[redirects]]
from = "/"
to = "https://sophonaut.com" #you may want to change this to /index.html
status = 200
force = true
potato
August 2, 2020, 10:49pm
3
Thanks for the quick reply! But looks like that solution is :drake_shaking_his_head_no_meme:
Scott
August 3, 2020, 12:57pm
4
Hey @potato ,
The more I think about it, the rule you mentioned should work, as long as you have an index.html
present in your publish directory .
Because you don’t force the rule, that means the site where the rule is applied will serve it’s own content if the page is available.
So… dumb question perhaps but do you have an index.html
?