0

I am using firebase hosting. At first, i used default domains but now i have changed it to custom domain. Now i changing address in google search console for the default domain but i am getting the 301 redirect error. Following is my firebase.json file and the google search console error screenshot.

    {
  "hosting": {
    "public": "root",
    "site": "ai-dream",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ],
    "redirects": [ {
    "source": "ai-dream.web.app",
    "destination": "dream-interpreter.online",
    "type": 301
  },{
    "source": "ai-dream.firebaseapp.com",
    "destination": "dream-interpreter.online",
    "type": 301
  } ]
  }
}

enter image description here

5
  • Your redirect isn't set up correctly. I get the same results as Google: $ curl --head https://ai-dream.web.app/ -> HTTP/2 200 Commented Aug 25, 2023 at 12:04
  • It looks like your configuration isn't creating a 301 redirect. it is creating a JavaScript redirect. I see this in the source code of the page: location.replace("https://dream-interpreter.online"); I have no idea how to fix that though, because I've never used firebase. Commented Aug 25, 2023 at 12:05
  • i did this when i couldnt get the redirects done by json. Now its working but it would be good if i could do this by simple json.
    – Sireiz
    Commented Aug 25, 2023 at 21:15
  • This person says they got it to work stackoverflow.com/a/76293250/1145388 and the they use https:// in their source then have a second entry with :path at the end. Commented Aug 26, 2023 at 6:56
  • i tried it with https too but it didnt redirected. May be i didnt give it enough time. let me try it one more time and wait one or two days. lets see what happens.
    – Sireiz
    Commented Aug 26, 2023 at 23:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.