At the request of SEO experts, I need to implement the following functions. I have to redirect if the link contains capital letters. For example https://domain.com/#Contacts ==> https//domain.com/#contacts.
In Nuxt, I do this by creating a function on the server.js file in the middleware folder.
But if the path contains hash(#), it will not work
export default function (req, res, next) { const url = req.url; if (url !== url.toLowerCase()) { res.writeHead(301, { Location: url.toLowerCase() }); res.end() } else { next(); } }
I would be grateful if you answer or provide help
The hashed part (Fragment Identifier) is never sent to the server through the browser connection, so your attempt to use a redirect is impossible.
You can access them client-side, but I don't think that does any SEO good.