提问人:Ruslan Makhmatov 提问时间:11/1/2023 更新时间:11/1/2023 访问量:14
主页索引为 404
Main page indexing as 404
问:
我已经用 react 和 react-router v6 制作了一个网站,并且我已经连接了 prerender.io,所以我正在努力进行索引,出于某种原因,我的主页索引为我的自定义 404 错误。但是,它通过 url: https://dental-home.ru/ 工作正常。将不胜感激你们的任何帮助
路由器:
<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>
答: 暂无答案
评论