1

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

enter image description here

4
  • Is your web server configured to serve your react application for every URL regardless of whether or not React has a valid routing for that URL? Apr 29 at 12:21
  • @StephenOstermiller I did not configure anything in netlify I just uploaded my site output folder (build) folder , I used this guide freecodecamp.org/news/…
    – MrXQ
    Apr 29 at 12:24
  • Is there a .htaccess file in your build directory that you uploaded? Apr 29 at 12:35
  • @StephenOstermiller No there is not, I have _redirects file in my public directory which is required in order to react-router redirection to work
    – MrXQ
    Apr 29 at 12:38

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.