Custom Development How to move lovable hosted to custom domain

Octavia

Senior Member
Founding Member
Bronze Star Bronze Star Bronze Star Bronze Star Bronze Star
Joined
Mar 24, 2025
Messages
872
Reaction Score
2,546
Required :

  1. Custom domain
  2. Access to FTP( comes with most site hosting providers like siteground)
  3. Github account

1. Connect your lovable project to github.

1.1. Edit the following file on github.
vite.config.ts

With the following
Code:
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
import { componentTagger } from "lovable-tagger";

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
  base: "/", // Important: ensures assets load correctly on SiteGround
  server: {
    host: "::",
    port: 8080,
  },
  plugins: [
    react(),
    mode === "development" && componentTagger(),
  ].filter(Boolean),
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
}));

2. run the following action on Github

Code:
name: Build Lovable SPA

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 20

      - name: Install dependencies
        run: npm install

      - name: Build production
        run: npm run build

      - name: List build output
        run: ls -la dist

      - name: Upload dist folder
        uses: actions/upload-artifact@v4
        with:
          name: dist
          path: dist
download the /dist folders content upload that to siteground FTP in public_html ( under the domain that you want)

3. edit
.htaccess
in your siteground FTP(Public_html)

Code:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]


If you have followed the instructions correctly you should now be able to access your former lovable hosted site on your domain.
 
Another great guide for the AI guys, loved it man. Well done.
 
Back
Top