404 page not found trying to navigate between pages in my Firebase app - firebase-hosting

I am building a Firebase app which runs correctly on my local server. But when deploy it to the Firebase Hosting I can't navigate between pages. After deploy it goes to the index.html page normally without problem
The problem is that when i clik on a link a get a 404 page. this how i am writting my link
<a href="secondPage.html"/>go to the second page </a>
I have my index.html and secondPage.html in the same directory

Related

Flutter Firebase Authentication Email Templates 404 Page Not Found Error

ScreenShot
When I open the link in the email that is sent by Firebase Auth it self, I'm getting 404 Page Not Found screen. However, I have different web apps as well, and I don't have this problem with them. Only difference between this project and others is this project in Production mode.
Note: Site is working as expected, except email links (I'm not facing this 404 page if I just open my web site).
I run flutter doctor -v and there is no problem.
I have tried flutter clean but no result.
I have updated firebase packages but no result.

Flutter Web Routing on deplpoying return 404 not found page

In my flutter web, I use route-generating to navigate around the debug running side (localHost), from home to profile, and so on.
However, when I publish the website to the internet, the routing appears to be missing.
I open the website normally; everything is fine until I refresh the page, at which point BOOM! The page crashes and returns a 404 error: not found.
I tried multiple solutions, such as adding a 404.html file to my web Folder, and i tried to add .htaccess like the solution in this problem here .
https://stackoverflow.com/a/72147109/14865120
So what is there any other solution to Fix this problem??

Netlify shows Page Not Found error with Flutter apps using GoRouter

I have created an app using Flutter v3, and I am using GoRouter to handle all the routes. When I run the app on localhost, everything is working fine. But when I try to go to /signIn page after uploading it to Netlify, it shows a "Page Not Found" error.
URL: https://63406985ec088a30cd8c9de8--allmity-beta.netlify.app/
When you open the above URL, you will automatically be redirected to https://63406985ec088a30cd8c9de8--allmity-beta.netlify.app/signIn.
But when you go to https://63406985ec088a30cd8c9de8--allmity-beta.netlify.app/signIn directly, it will show the error.
I was able to fix the error by adding a 200 redirect rule in netlify.toml file to redirect all requests to /.
Here are a few helpful resources:
https://answers.netlify.com/t/support-guide-direct-links-to-my-single-page-app-spa-dont-work/126
https://www.netlify.com/blog/2019/01/16/redirect-rules-for-all-how-to-configure-redirects-for-your-static-site/

How to create admob app-ads.txt file flutter web app?

I have a website made with flutter web. My app which shows google admob ad. Now google admob told me to create an app-ads.txt file on my website . Flutter web is a single page website so, is it possible to create an app-ads.txt file with my flutter web app !?
I also recently tried flutter web. I went on a "fishing expedition", and managed to solve this issue.
What i did:
Place your app-ads.txt in <project>/web folder.
Run flutter build web
Check that app-ads.txt appeared in build/web folder.
Check that in build/web/flutter_service_worker.js in RESOURCES map appeared a record with key "app-ads.txt"(ex. "app-ads.txt": "4c75380ac52243715a448e96239e0ca5",)
Run firebase deploy --only hosting
After this, app-ads.txt should be available on https://your-domain.web.app/app-ads.txt, https://your-domain.firebaseapp.com/app-ads.txt and(if you added a custom domain) on https://my-custom-domain.com/app-ads.txt.
P.S. If you got redirected from /app-ads.txt to your main page, then try to clear your site cache:
Press F12
Open "Application" tab
Choose "Storage"
Press "Clear site data"
After this, app-ads.txt should be available.

Ionic 4 PWA - Add standard html page in Ionic project

I have an Ionic 4 PWA project and need to add a standard html page which I can access directly via the url.
The problem is when I add the html page in the root (src/app/test.html) or in a folder (src/app/folder/test.html), I cannot access it directly via url - myweb.com/folder/test.html
However, if I put it in my assets folder (src/assets/test.html) I can access it directly via url - myweb.com/assets/test.html
So what do I need to setup so I can access the html in root or specific folder?
An Ionic / Angular PWA typically utilises one host file i.e., index.html from which your PWA is loaded. Once your PWA is loaded navigation is handled by Angular's Router.
By convention static assets are served from the assets directory.
Also see: The Angular Style Guide