Estoy haciendo un acortador de URL y tratando de abrir el enlace con sus identificaciones únicas almacenadas en mi base de datos. Este es mi código para ello:
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.9.2/firebase-app.js"; import { getDatabase, ref, onValue } from "https://www.gstatic.com/firebasejs/9.9.2/firebase-database.js"; // TODO: Add SDKs for Firebase products that you want to use // https://firebase.google.com/docs/web/setup#available-libraries // Your web app's Firebase configuration const firebaseConfig = { apiKey: "...", authDomain: "...", projected: "...", storageBucket: "...", messagingSenderId: "...", appId: "...", }; const app = initializeApp(firebaseConfig); const db = getDatabase(); const get = ref( db, "Urls/" + (window.location + "").split("/")[(window.location + "").split("/").length - 1] ); console.log(((window.location + "").split("/")[(window.location + "").split("/").length - 1])) onValue(get, (snapshot) => { window.location.href = snapshot.val().actualUrl }); Ahora, de acuerdo con esto, mi URL se verá así: link.shortly.com/uniqueLinkId (durante la prueba, será fileLocation/link-opener.html/uniqueLinkId ), pero esto no funciona durante la prueba. Cuando le doy a la URL este valor adicional, al final, aparece este error: 
Supongo que este problema desaparecerá cuando lo hospede, pero lo estoy probando antes de hospedarlo.
Además, me encantaría saber cómo puedo agregar valor adicional en estos casos.