Ad

Laravel 5 & Vue Components – Remove Public From URL

- 1 answer

I have a Laravel 5 project with Vue components. The project works fine.

But I removed the "/public" from the path using this instruction: Remove /public from URL

And now vue components don't work. Which files do I need to modify to recover Vue components?

Ad

Answer

I answer myself.

I hope this doesnt affect my status. Please administrators let me know...

After modify I need changing .htaccess like this:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]

In this way the static files components will not be ignored. Like this components work again

Ad
source: stackoverflow.com
Ad