5

I have a finished react app that works well on my localhost with npm start. I created the project with create-react-app and used the npm run build to compile a production website.

I have the whole folder with the index.html on my webspace. (They use an apache html server).

I managed to write an .htaccessfile that loads the html correctly. Now there is only a white screen. It seems like the main.js is not being loaded into the root div.

The only error I get in the console is that the service-worker could not be installed as my request comes not from a secure origin. This should not stop the rendering right?

I am not sure what files would be necessary to show here so please do let me know what you need to see to hopefully fix the problem.

Thank you!

2 Answers 2

5

After Running npm run build command.

Copy and paste everything in build folder to your server.

Create a “.htaccess” file and add this snippet :

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]

The application should work correctly.

Sign up to request clarification or add additional context in comments.

1 Comment

I have done all that. It does not work I get on the site but there is nothing redered
1

maybe its because you have ProxyPass in your conf file. you need to specific the homepage of your application.

{ "name": "application-name", "version": "1.0.0", "description": "", "homepage": "https://www.yourdomain.com/appliaction-context-path", }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.