[英]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.