大网数据广告活动
网站运营与故障问答

Google Search Console indexing non existent pages for a Create React App website with react-helmet-async hosted on Netlify

· 52CE 我爱测

Google is showing non-existing pages when I search for my website (hosted on Netlify ) it looks like this: https://*********.com.tr/Achlamydeae1901520.html or https://*********.com.tr/Cumar1152083.html (These pages Does not exist…

问题原文

原帖链接 · MrXQ · CC BY-SA 4.0

Google is showing non-existing pages when I search for my website (hosted on Netlify)

it looks like this: https://*********.com.tr/Achlamydeae1901520.html or https://*********.com.tr/Cumar1152083.html (These pages Does not exist and the user will get redirected to the 404 custom page I created).

my sitemap.txt looks like this :

https://*********.com.tr/
https://*********.com.tr/about
https://*********.com.tr/companies
https://*********.com.tr/team
https://*********.com.tr/activities
https://*********.com.tr/contact

my _redirects file looks like this :

/*    /index.html   200

my robots.txt file looks like this :

User-agent: Googlebot
Disallow: /nogooglebot/

User-agent: *
Allow: /

Sitemap: https://*********.com.tr/sitemap.txt

my meta in react-helmet-async looks like this :

<Helmet>
     <title>website title</title>
              <meta
                name="description"
                content="This is a desciption"
              />
              <meta
                name="keywords"
                content="this is the website keywords"
              />
             
    
              <link rel="canonical" href="/" />
</Helmet>

my React router v6 looks like this :

      <Router>
        <Routes>
          <Route path="/" element={<Home />} />
          <Route index element={<Home />} />
          <Route path="contact" element={<ContactUs />} />
          <Route path="companies" element={<OurCompanies />} />
          <Route path="team" element={<OurTeam />} />
          <Route path="about" element={<AboutUs />} />
          <Route path="activities" element={<Activities />} />
          <Route path="news" element={<ComingSoon />} />

          <Route path="*" element={<Error404 />} />
        </Routes>
      </Router>

How can I resolve this issue?

EDIT : In Google Search Console I found that there are more than 3k URLs like the two I have mentioned above under the Coverage category This is a screenshot to demonstrate

已采纳解答

原帖链接 · MrXQ · CC BY-SA 4.0

The problem has been solved thanks to the awesome people at Google Search Help.

This answer from there worked for me:

Looks like you're a purely client side rendered site here, so the page returns a 200 status. (You can't change a status code client side)

So despite the page saying 404, it's really a 200.

The two options for a client side routed site are:

  • Add a noindex tag
  • Or do a JavaScript redirect to a page outside the app, that actually returns a 404

Both will work about the same, and result in the same outcome (these URLs being dropped from the index) so really pick the easiest to implement.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2022-04-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。