主页索引为 404

Main page indexing as 404

提问人:Ruslan Makhmatov 提问时间:11/1/2023 更新时间:11/1/2023 访问量:14

问:

我已经用 react 和 react-router v6 制作了一个网站,并且我已经连接了 prerender.io,所以我正在努力进行索引,出于某种原因,我的主页索引为我的自定义 404 错误。但是,它通过 url: https://dental-home.ru/ 工作正常。将不胜感激你们的任何帮助enter image description here

路由器:

<Router>
<ScrollToTop></ScrollToTop>
<Routes>
  <Route path="/" element={<Home />} />
  <Route path="/children-dental" element={<ChildDental />}></Route>
  <Route path="/prices" element={<PricesPage />}></Route>
  <Route path="/privacy" element={<Privacy />}></Route>
  <Route path="/reviews" element={<ReviewsPage />}></Route>
  <Route path="/works" element={<WorksPage />}></Route>
  <Route path="/doctors" element={<DoctorsPage />}></Route>
  <Route path="/clinics" element={<ClinicsPage />}></Route>
  <Route path="/contacts" element={<ContactsPage />}></Route>
  <Route path="/services/whitening" element={<Whitening />}></Route>
  <Route path="/services/hygiene" element={<Hygiene />}></Route>
  <Route
    path="/services/bite-correction"
    element={<BiteCorrection />}
  ></Route>
  <Route path="/services/teeth-healing" element={<TeethHealing />}></Route>
  <Route path="/services/prosthetics" element={<ProstheticsPage />}></Route>
  <Route path="/services/vinirs" element={<VinirsPage />}></Route>
  <Route path="/services/surgery" element={<Surgery />}></Route>
  <Route path="/services/diagnostic" element={<DiagnosticPage />}></Route>
  <Route
    path="/services/child-bite-correction"
    element={<ChildBiteCorrection />}
  ></Route>
  <Route
    path="/services/child-diagnostic"
    element={<ChildDiagnostic />}
  ></Route>
  <Route path="/services/child-surgery" element={<ChildSurgery />}></Route>
  <Route path="/services/child-teeth" element={<ChildTeeth />}></Route>
  <Route path="/services/child-hygiene" element={<ChildHygiene />}></Route>
  <Route path="/services/child-sleep" element={<ChildSleep />}></Route>
  <Route path="/error" element={<Error />}></Route>
  <Route path="*" element={<Error />} />
</Routes>

.htaccess:

    <IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  Redirect 301 /paradontologiya https://dental-home.ru/services/diagnostic
  Redirect 301 /uslugi https://dental-home.ru/#services
  Redirect 301 /diagnostika https://dental-home.ru/services/diagnostic
  Redirect 301 /protezirovanie https://dental-home.ru/services/prosthetics
  Redirect 301 /implantatsiya https://dental-home.ru/services/prosthetics
  Redirect 301 /gigiena https://dental-home.ru/services/hygiene
  Redirect 301 /lechenie https://dental-home.ru/services/vinirs
  Redirect 301 /anasteziologiya https://dental-home.ru/services/diagnostic


  # Redirect www to non-www
  RewriteCond %{HTTP_HOST} ^www\.(.*)$
  RewriteRule ^(.*)$ https://%1/$1 [L,R=301] 

  # Prerender.io configuration
  <IfModule mod_headers.c>
      # Set the prerender token
      RequestHeader set X-Prerender-Token "MY_TOKEN"
  </IfModule>
  
  RewriteCond %{HTTP_USER_AGENT} googlebot|bingbot|yandex|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator [NC,OR]
  RewriteCond %{QUERY_STRING} _escaped_fragment_

  # Proxy the request to Prerender if it's a request for HTML, but not for certain file types
  RewriteRule ^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.torrent|\.ttf|\.woff|\.svg|\.eot))(.*) http://service.prerender.io/https://dental-home.ru/$2 [P,L]

  # Existing rules
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]

  ErrorDocument 404 https://dental-home.ru/error
  </IfModule>
ReactJS Google-Chrome SEO 路由器

评论

0赞 Stephen Ostermiller 11/1/2023
您是否使用 Google Search Console 验证了您的网站,并使用其中的网址检查工具来调试 Googlebot 为您的网站查看的内容?
0赞 Ruslan Makhmatov 11/2/2023
是的,即使在其他浏览器中,主页也是 404
0赞 Stephen Ostermiller 11/2/2023
Google Search Console 不是浏览器:search.google.com/search-console/about

答: 暂无答案