I'm assuming you have already enabled/configured mod_proxy (and related modules) in the server config.
Try the following instead:
Options +FollowSymlinks -MultiViews
ErrorDocument 404 /404.php
DirectoryIndex index.html
RewriteEngine On
# HTTP to HTTPS redirect
RewriteCond %{SERVER_PORT} 80
RewriteRule ^ https://my.website.ge%{REQUEST_URI} [R=301,L]
# Rewrite rule for /presscenter requests
RewriteRule ^presscenter http://localhost:3000%{REQUEST_URI} [P]
# No further processing if URL starts "/pcms" and "fbclid" URL param at start of qs
RewriteCond %{QUERY_STRING} ^fbclid=
RewriteRule ^pcms - [L]
# Front-controller for react.js app
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.html [L]
I've simplified some of the regex, eg. ^pcms
is the same as ^pcms/?
- whether that is really the intention or not it's not clear. (Although I suspect you probably intended it to match pcms
or pcms/<something>
, in which case the regex should be ^pcms($|/)
instead.)
A little curious is that you also have /404.php
(a PHP script?), although this is rarely used. The ErrorDocument 404
is only relevant for requests that start /pcms
and have a fbclid
URL parameter at the start of the query string and which do not map to a physical file or directory.
# Rewrite rule for all other requests
RewriteCond %{REQUEST_URI} !^/presscenter [NC]
RewriteRule ^(.*)$ /index.html [L]
This is not required (but it is also incorrect) since the request is rewritten to index.html
by a later rule. If you rewrite any request that does not start /presscenter
then it will essentially result in a rewrite loop since it rewrites everything - including all static assets - to itself (index.html
).