Remove Ugly params

live host - sye.lol

I made a button that takes you to profile.html with an ID that was inputted and everything works great besides the ugly params, the url currently looks like this “sye.lol/profile.html?id=208168562286788610” but my goal is to get “sye.lol/208168562286788610”. I added this for my _redirects but nothing

/:discordID    /profile.html?id=:discordID    200

here is my javascript

submitButton.addEventListener('click', async function() {
    const discordId = discordInput.value.trim();
    
    if (discordId !== '') {
        const servercheck = await fetch(`https://api.lanyard.rest/v1/users/${discordId}`)
        const requestdata = await servercheck.json()

        if (requestdata.success === false) {
            
            body.classList.add('animate-fade-out');

            
            setTimeout(() => {
                window.location.href = 'error.html'; e
            }, 1000); 
            return;
        }

        
        body.classList.add('animate-fade-out');

        
        setTimeout(() => {
            window.location.href = `profile.html?id=${discordId}`;
        }, 1000); 
    }
});

Netlify preserves the query params and there’s no way to remove those other than overwriting them with new params. I’d suggest using client-side JavaScript to remove the params.

Ah got it thank you, do you know how Id go about doing that I’ve tried everything so far.

I’m not sure if I understand what you’re trying to say here. Could you please clarify?

My bad, my issue is that the URL is too long, and I want it to be shorter. For example, this is what I have https://sye.lol/profile.html?id=208168562286788610 and this is what I want https://sye.lol/208168562286788610 using the JavaScript above. If you don’t offer this type of support its completely fine just an issue I’ve had for a long time that I can’t seem to fix.

Edit: fixed my issue

You’re asking for help with JavaScript which is not something we help with as that’s writing custom code which is outside of our scope of support. With that being said, you can use this as an example to get started:

location.href = `/${new URL(location.href).searchParams.get('id')}`