-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document react router basename for relative builds #2593
Comments
Are you using React Router? If so, I'd check the configuration. Also you'll need to catch all your path requests to go to Are you able to share your code? |
Have you done https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#serving-apps-with-client-side-routing ?
|
I'll go ahead and close this because we have a section in our documentation which explains how to do this. |
Hi , |
@jsk548 sadly, I cannot help much with that information.
|
Further more, here is what i found.
|
It means that you need to set homepage field in the package.json https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#building-for-relative-paths |
@viankakrisna samething happening. i added "homepage": "demo1.gd.com/cliq" in package.json no change from previous build. it takes me to demo1.gd.com/products |
@jsk548 btw, I cannot access demo1.gd.com, is it a virtualhost? |
We're hesitant to put the public URL fix in the docs because it might be changing in the future. The HTML base tag looks promising. What kind of browser support does that have? |
It's an old spec. So it's pretty well supported. It has gotcha though https://stackoverflow.com/questions/1889076/is-it-recommended-to-use-the-base-html-tag |
I just found out that react router v4 supports basename on BrowserRouter though https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string |
Oh sweet we should probably suggest the basename feature in react-router then. |
Anybody want to send a doc PR? |
Let's open this because I think it's really important |
Is there a solution guys? |
If you are using react router v4, just use the basename feature linked above. If not, can you share a reproducible example? It's easier to work with code rather than guessing what is wrong. |
Hi @viankakrisna , |
aaah, you are using apache tomcat, the guide is specifically for Apache HTTP Server with support for |
After a revelation in facebook#2593 (comment)
* Add more info about apache client side routing After a revelation in #2593 (comment) * Update README.md
* Add more info about apache client side routing After a revelation in facebook/create-react-app#2593 (comment) * Update README.md
* Add more info about apache client side routing After a revelation in facebook#2593 (comment) * Update README.md
* Docs for react-router v4 basename feature Fix #2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Add more info about apache client side routing After a revelation in facebook/create-react-app#2593 (comment) * Update README.md
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Add more info about apache client side routing After a revelation in facebook#2593 (comment) * Update README.md
* Docs for react-router v4 basename feature Fix facebook#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Docs for react-router v4 basename feature Fix facebook#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Add more info about apache client side routing After a revelation in facebook/create-react-app#2593 (comment) * Update README.md
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Add more info about apache client side routing After a revelation in facebook/create-react-app#2593 (comment) * Update README.md
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
* Docs for react-router v4 basename feature Fix facebook/create-react-app#2593 * Update README.md * Update README.md * Update README.md * Update README.md
Hi ,
I have created a demo project and deployed to Apache server but React Routes are not working. When i click on product it should go to "/product" but here it shows object not found. Could you please give permanent solution for this.
The text was updated successfully, but these errors were encountered: