I am currently deploying my NuxtJS SSR App on Server Pilot. I can excute npm run build and run start on the server and it will start listening on http://localhost:3000. How can I redirect my www.example.com to localhost:3000. Using htaccess.
1 Answer
It seems to be a bit late for this answer, but I only found it in github and would like to help anyone who finds this topic with the same problem.
This htaccess is working for me, it loads the index.vue page normally when I refresh and the navigation works.
Replace my-domain with your domain.
RewriteEngine on
# Forcing all incoming requests to HTTPS.
# HTTPS is required for PWA. If you don't want PWA feature you can deisable next 2 lines
RewriteCond %{HTTP_HOST} ^my-domain.com.br$
RewriteRule "(.*.(jpg|gif|png|svg|js|css|woff2))$" "http://127.0.0.1:3000/$1" [P,NC]
RewriteRule ^(.*) "http://127.0.0.1:3000/$2" [P,L]
-
Thansk for the help, noob question though. Where would i put the .htaccess file in my nuxt file structure? would it go in the static folder or in the root along side the nuxt.config ? Thanks Feb 24, 2021 at 9:57
-