Configuration of . htaccess for Nodejs and React application using the same domain

Asked

Viewed 281 times

0

Hello,

I am configuring an application on a cPanel server. The backend was developed in Node JS and will be published in a URL with the following format: https://teste.com/api;

The frontend was developed in React JS and will be published in the URL https://teste.com

The . htaccess file has been configured this way, according to documentation (Create React App)

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

The question is how can I set the . htaccess file to redirect to index.html (as it already does), except for when the requested URL is https://teste.com/api/qualquercoisa ?

Thank you,

  • I didn’t know they used . htacces with nodejs. For me . htacces was only used with apache.

  • @Augustovasques, apache yes! I am publishing a Node application on the apache server.

  • You are using the /api with an apache-proxy?!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.