I have created my application using laravel and vue.js and hosted my application on server in subfolder inside public_html,
Accessing it using url like this:
but after login if i click on any link it points back to
https://maindomain.in/dashboard
and i get 404 not found in console for the api routes that are accessed for eg. accessing dashboard
My root htaccess file content is :
<IfModule mod_rewrite.c>
RewriteEngine on
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Remove public folder form URL
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Note: Frontend is in Vue.js and backend in laravel.
Any help is highly appreciated
2
Answers
It seems to me like your web server is not pointing to the right folder.
Laravel expects you to serve the project from the
public
folder inside the project’s root directory.You’re serving it from the main
apache/nginx
folder. That’s why you need to add the subfolder and public folders in the URL to visit the website.Check the Laravel Nginx configuration example to notice the
root
directory they’re specifying.Your nginx/apache server is configured wrong
You must point nginx/apache to the folder
/var/www/XXX_PROJECT_XXX/