简体   繁体   中英

Linked POST INSPECTOR giving 404 - React APP

I'm using React app for web development and there is a concept called "share company profile". While sharing the URL it shows something went wrong and in the LinkedIn post inspector it show like below: 链接检查器 But on Facebook it works fine since it's a React app. I have placed all meta and OG tags in index.html itself.

while giving the base url in inspector its working fine but with params like /company/IN-Gowtham-28/ not working

If that is a valid URL and your app is a SPA (single page app) made with react, the only thing I can think of is your default redirection. Let me explain:

A react SPA creates only 1 page (/index.html) which includes your entire app, including the router and subsequent pages. so if you try to load /another/page/ that will return a 404 as there's no HTML file at the location. In order to avoid that, your web server should redirect all HTML requests to /index.html. depending on your server or hosting of choice there are several ways to do that. from there, react (react-router) will show the proper page depending on URL location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM