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

MarcDeGagne's avatar

Livewire - livewire/message{name} returns 404 in subfolder install

Hey all,

I just deployed into production a new site using Laravel and Livewire.

On local all is fine and working.

After pushing into production onto a live server (using Cpanel) on shared hosting, I get all routes of POST request to /plants/livewire/message{name} returning a 404.

The site is structured to work under a virtual subdirectory of public_html named /plants/. I am using a symbolic link to point towards /home/user/Laravel-app/public/ for the virtual subdir /plants/....

All other livewire route listed in route:list seems to work. The mount()methods are all working as expected.

Note also that all other routes in prefix( "admin") using POST /livewire/message/{name} to update data do return a 404 as well.

Your help is appriciated!

Thanks

0 likes
8 replies
LaryAI's avatar
Level 58

This issue could be caused by the server not being able to handle the POST request to the livewire/message{name} route. One solution could be to add a rewrite rule to the .htaccess file to handle the livewire requests.

Here's an example of what the .htaccess file could look like:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^subdir-name/livewire(/.*)?$ /subdir-name/index.php [L]
</IfModule>

Replace "subdir-name" with the name of the subdirectory where your Laravel app is located.

If this solution doesn't work, it could be helpful to check the server logs for any errors related to the livewire requests.

Snapey's avatar

Because your document root is not the public folder

MarcDeGagne's avatar

@Snapey

Thanks Snapey,

In the root public_html folder I already have a WordPress site. This Laravel site is an extension of the current site, which was not conveniently possible to do with WP.

Well, obviously so far this seems to be the case for the POST methods only:

GET|HEAD livewire/livewire.js

GET|HEAD livewire/livewire.js.map

POST livewire/message/{name} || livewire.message

GET|HEAD livewire/preview-file/{filename} || livewire.preview-file

POST livewire/upload-file || livewire.upload-file

The GET methods are working for Livewire since the mount methods are returning the expected content.

Now how to correct this path for the POST methods is the question?

POST https://some-domain.com/plants/livewire/message/show-image-module 404

MarcDeGagne's avatar

So is there a way to rewirte the rotue to Livewire POST path for /Livewire/message/{name}?

I tried without success. Still returning a 404:

Route::post( "/plants/livewire/message/{name}", "Livewire\Controllers\HttpConnectionHandler" );
taha118's avatar

solve the issue by creating a provider.

path after domain name is PATH_TO_LARAVEL

`

public function boot() { Livewire::setUpdateRoute(function ($handle) { return Route::post(config('constants.PATH_TO_LARAVEl') . '/livewire/update', $handle); }); }

`

Please or to participate in this conversation.