[英]Problems deploying Vue project after build on Apache webserver due to wrong relative paths
[英]Laravel project is calling the wrong paths
我是 Laravel 的新手,我正在測試我制作的應用程序。 在本地它工作正常但是當我將它推送到服務器時,路由似乎 go 真的很糟糕。 通常,視圖的路徑類似於156.0.125.1/app/index
,但它一直在尋找 156.0.125.1/index ,這會導致錯誤 URL not found on server
我懷疑它是 .htaccess 文件,但我不太確定在那里更改什么,因為我不熟悉它。
服務器上的站點似乎也沒有讀取 css 和 js
這是htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
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]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
# Disable Directory listing
Options -Indexes
# block files which needs to be hidden, specify .example extension of the file
<Files ~ "\.(env|json|config.js|md|gitignore|gitattributes|lock)$">
Order allow,deny
Deny from all
</Files>
將此文件 app/public/index.php 移動到您的服務器文檔根目錄
並進行以下更改 Change ''' require DIR .'/../vendor/autoload.php ''' to ''' require DIR .'/app/vendor/autoload.php ''' Change ''' require_once .'/../bootstrap/app.php ''' to ''' require_once DIR .'/app/bootstrap/app.php ''' 在 app/server.ZE1BFD4Z062321E4906 中進行以下更改
將 ''' require_once DIR .'/public/index.php ''' 更改為 ''' require_once DIR .'/../index.php '''
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.