whitebear
whitebear

Reputation: 12445

Set .htpasswd .htaccess for React build directory

I am using apache to host the ReactProject

I put .htpasswd and .htaccess in ReactProject/build directory, it works.

However once I did npm run build again.

Both files were deleted.

How can I prevent this??

Upvotes: 1

Views: 1060

Answers (1)

pyo
pyo

Reputation: 11

you can put them in a public folder!

The reason the files were deleted is whenever you npm run build, public folder moved to build folder. It simply means if you do npm run build, the build folder is made by public folder.

Upvotes: 1

Related Questions