Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

blacknet's avatar

inertiajs with vue website not visual in production in cPanel hosting

i've build using npm run build and host in cPanel but it shows my page location not found.

here is my app.js file code

import { createApp, h } from 'vue'
import { Head, Link, createInertiaApp } from '@inertiajs/vue3'
import Alink from './Shared/Alink.vue';
import ImageProcess from './Shared/ImageProcess.vue';
import Pagination from './Shared/Pagination.vue';

import {layouts} from './Plugins/layouts';
import { notifications,notify } from './Plugins/notification';
// Import the CSS or use your own!
import "vue-toastification/dist/index.css";
import Toast from "vue-toastification";



createInertiaApp({
    resolve: async name => {
       
        const parts = name.split('/');
        const path = parts.length > 1 ? `./Pages/${parts.join('/')}.vue` : `./Pages/${name}.vue`;

        const page = (await import(/* @vite-ignore */path)).default;

        if (page.layout === undefined) {
            page.layout ??= name.startsWith('backend/')?layouts.AdminLayout:layouts.FrontLayout
        }
        return page;
    },
    progress: {
        delay: 250,
        color: 'red',
        includeCSS: true,
        showSpinner: true,
      },
    setup({ el, App, props, plugin }) {
        const myApp = createApp({ render: () => h(App, props) });
        myApp.config.globalProperties.$route = route
        myApp.use(notifications)
        myApp.use(Toast)
        myApp.use(plugin)
            .component('Link', Link)
            .component('Head', Head)
            .component('Alink', Alink)
            .component('ImageProcess',ImageProcess)
            .component('Pagination',Pagination)
            .mount(el)
    },
    title:title=>title+'- Doctor Appointment',
})

and this is my vite.config.js file

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';


export default defineConfig({
    plugins: [
        vue(),
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js'],
            refresh: true,
        }),
    ],
});

in my local environment working properly but not worked in cPanel

0 likes
2 replies
jlrdw's avatar

Is the project correctly pointing to public as document root?

blacknet's avatar

@jlrdw yes, I've. It's the same .htaccess code I used in my other live Laravel project.

<ifmodule mod_rewrite.c>

    RewriteEngine On
   
     <ifmodule mod_negotiation.c>
        Options -MultiViews
    </ifmodule>
    
     # Force HTTPS
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Force www
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Remove public URL from the path
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteRule ^(.*)$ /public/ [L,QSA]


    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    
</ifmodule>

Please or to participate in this conversation.