简体   繁体   English

Laravel 项目正在调用错误的路径

[英]Laravel project is calling the wrong paths

I am new to Laravel and I am testing out an application that i have made.我是 Laravel 的新手,我正在测试我制作的应用程序。 locally it works fine but when I push it to a server, then the routing seems to go really bad.在本地它工作正常但是当我将它推送到服务器时,路由似乎 go 真的很糟糕。 Usually a path to a view would be like 156.0.125.1/app/index , but it keeps looking for 156.0.125.1/index which gives the error of URL not found on server通常,视图的路径类似于156.0.125.1/app/index ,但它一直在寻找 156.0.125.1/index ,这会导致错误 URL not found on server

I suspect its the .htaccess file but I'm not too sure what to change there as I'm not familiar with it.我怀疑它是 .htaccess 文件,但我不太确定在那里更改什么,因为我不熟悉它。

also the css and the js seem to not be read by the site on the server服务器上的站点似乎也没有读取 css 和 js

heres the htaccess这是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>

Move this file app/public/index.php to your server document root将此文件 app/public/index.php 移动到您的服务器文档根目录

and make the following changes Change ''' require DIR .'/../vendor/autoload.php ''' to ''' require DIR .'/app/vendor/autoload.php ''' Change ''' require_once DIR .'/../bootstrap/app.php ''' to ''' require_once DIR .'/app/bootstrap/app.php ''' In app/server.php make the following changes并进行以下更改 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 中进行以下更改

Change ''' require_once DIR .'/public/index.php ''' to ''' require_once DIR .'/../index.php '''将 ''' require_once DIR .'/public/index.php ''' 更改为 ''' require_once DIR .'/../index.php '''

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM