My .htaccess config
:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^example\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
RewriteRule ^$ http://127.0.0.1:47777/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:47777/$1 [P,L]
RewriteBase /
RewriteCond %{THE_REQUEST} index\.php
RewriteRule ^index\.php$ http://127.0.0.1:47777/ [R=301,L]
I'm successfully able to host my node app on the server using above redirect but the issue is that it expects index.php
to be the route Like When I access URL: example.com
it rewrites to 127.0.0.1:47777/index.php
But the route index.php is not defined.
I tried the above snippet:
RewriteBase /
RewriteCond %{THE_REQUEST} index\.php
RewriteRule ^index\.php$ http://127.0.0.1:47777/ [R=301,L]
But it still adds index.php to the end of the route.
*Note: I'm on a shared hosting so I can't access apache root configs *