Confused About Relative Url Anchor Tag
I'm confused about relative href url in anchor tag. I have a case below:
I have a homepage that can be accessed with abc.com/it or abc.com/it/index with return the same page. In that page I have anchor tag with relative url href='./about' (I can not use absolute or root-relative url in this case). The problem is:
When I access the page through url abc.com/it/index then click the anchor link, it will redirect to abc.com/it/about (this is my expected result).
But if I access the page through abc.com/it then click the link, it
will redirect to abc.com/about (this is not my expectation).
Anyone please give me a solution for this. Thank you all.
The solution is to add a trailing slash to your base URL, i.e.
Here is the relevant line from the specification of relative URLs (RFC 1808)
The last segment of the base URL's path (anything following the rightmost slash "/", or the entire path if no slash is present) is removed and the embedded URL's path is appended in its place.
I would also suggest adding a redirect from
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error