Zaid-Ajaj / Feliz.Router

A router component for React and Elmish that is focused, powerful and extremely easy to use.
MIT License
78 stars 16 forks source link

Trouble getting path-based functions to work #68

Open ciphertools opened 1 year ago

ciphertools commented 1 year ago

Thank you for Feliz.Router - it is one of many products from you that I am very grateful to use.

I am not sure if what I am about to describe is an issue with Feliz.Router. It is more likely to be an issue with me ...

Navigation works successfully on my SAFE Stack website using hash-based addresses, e.g. I can change from domain/ to domain/#/guide with no problem.

However, I am having trouble with SEO and Google recommends not using hashes in a URL, so I followed your suggestion about refactoring the application to use path-based functions instead. When I tested it locally, it worked, e.g. I could successfully change from localhost:8080 to localhost:8080/guide. But, when I uploaded the new version of the application to a web server, I was unable to navigate from the home page to any of the other linked pages as these pages could not be found. Is there something that I am overlooking?

ciphertools commented 1 year ago

I have tried again, and this time I can move from domain/ to domain/guide successfully, and this was because I followed the suggestion to override the full refresh, by using e.preventDefault() in the function called by prop.onClick. However, what I cannot do is type in the URL of domain/guide to navigate directly to that 'page', without going via domain/. This used to be possible when using the hash form of the URLs, i.e. typing domain/#/guide directly into the address bar would take me directly to that 'page'.

ciphertools commented 1 year ago

Sorry - I should have added this to the last comment.

When testing locally, it is possible to type in domain/guide to navigate directly to that page.

So, in summary: