My dear coding experts | Who using firebase work environment kindly give an answer to this.

RichKIDLK

BANNED
Joined
Aug 30, 2020
Messages
1,198
Reaction score
1,157
Dear friends,

How to 301 redirect this web project url.

I want to redirect

https://www.youtube.com/redirect?q=http%3A%2F%2Fexample.firebaseapp.com%2F&redir_token=QUFFLUhqbXVQT3d6czRzSV9HeGRRTG9WV25OOGx5WlhIQXxBQ3Jtc0tsNnBoMy1CZVNVVzBBd2VnVEU3aG9OYW9qaG9xV0RuejRVdE9XM2c1RWVXSWgwUVdWVGp0Q255RW9DVnI2TDRudUNuWDFWc25nTWxSRTFreEhLcDNucGY0VlZVSDJXTkczdWV3VThUVmVfU2paOEVmaw%3D%3D&event=comments&stzid=UgwomLocMyPAjar0FxZ4AaABAg

to the

https://www.youtube.com/redirect?q=http%3A%2F%2Fexample.web.app%2F&redir_token=QUFFLUhqazdrZ294TkkwQXRmWDFIRFZldTR4UUhyT2lVUXxBQ3Jtc0trZ21RQUlwcVFZeHVlZWRzMUJZV0FBWWpwRk0waVlHVENUWnJCcnVBQ1RieXh4T29YNUlQalhDdWNqTHpzVUlJQk9lM1RIV2JRaE1NMXkzQjF5Vk9wSTJWZW1ad0Z4UW5ua3RxeWpTYllDRUljbjd6RQ%3D%3D&event=comments&stzid=UgwomLocMyPAjar0FxZ4AaABAg

Kindly help me to resolve this.

-----------------------------------------------------
I have searched about this in internet and finally saw a solution. I don't know some part of that answer. Help me to resolve that.

I saw an answer in to my question here

https://www.youtube.com/redirect?q=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F34212039%2Fredirect-to-firebase-hosting-custom-domain&redir_token=QUFFLUhqbjFBQUxnQkF4QWZtWDBjTzNJdEYtTHh3c1pFZ3xBQ3Jtc0tsbXJwNzYzdk1HdzF5OGxNMUhkS2xHVklYankwdzF4bzhza2VtMHcxZHlZSGlLNW9vU1d4Z2NvT2FSRkFnVC1oMDVNZkJLdDJZSndlQ0hhRXRYVklaSTlHYy1MaHJtN2NWUmItQ1QwMEtBOFhwNE5ESQ%3D%3D&event=comments&stzid=UgwomLocMyPAjar0FxZ4AaABAg

In this answer he said that :

In addition to specifying canonical link as mentioned in Frank van Puffelen's answer. We can also add front end JavaScript code to do the actual redirect like this without disclosing default url.

1616601248263.png


Code:
if (location.hostname.indexOf('custom.url') === -1) {
    location.replace("https://custom.url");
}

But I don't know what he mentioned in that answer about "add front end JavaScript code"


How to do this? How to add this front end JavaScript code in to this?
 
Back
Top