我使用 laravel 和 vue.js 创建了我的应用程序,并将我的应用程序托管在服务器上的 public_html 子文件夹中, 使用这样的网址访问它:
https://maindomain.in/projectfolder/public/login
但登录后如果我点击任何链接,它会指向
https://maindomain.in/dashboard
并且我在控制台中找不到 404,用于访问的 api 路由,例如。访问仪表板
https://maindomain.in/api/backend/get-dashboatd-data
我的根 htaccess 文件内容是:
<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>
注意:前端在 Vue.js 中,后端在 Laravel 中。
非常感谢任何帮助