[英]route issue when I host my laravel 5 website on a Shared hosting
hello everyone I'm new on laravel. 大家好,我是laravel的新手。 I build my website which is perfectly working on the development machine but when I put it on my shared hosting it is just one route which is working ("/").
我建立的网站可以在开发机器上正常运行,但是当我将其放置在共享主机上时,它只是起作用的一种途径(“ /”)。 all the order routes are not working.
所有订单路线均无效。
web.php (the first route is working) web.php(第一条路线正在运行)
<?php
Route::get('/', function () {
return view('index');});
Route::group(['prefix' => '{lang}'], function(){
Route::get('index', function(){
return view('index');
});
Route::get('t', function(){
return view('construction');
});
Route::get('post', function(){
return view('post');
});
Route::get('posts', 'postController@index');
});
my .htacces 我的.htacces
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
index.blade.php is in the folder views of ressources and the lang files exist. index.blade.php在资源的文件夹视图中,并且存在lang文件。 if anyone can help me it will be great
如果有人可以帮助我,那就太好了
Here what you can do.. 在这里你可以做..
Step 1: Go to public
folder, copy .htaccess
file to root ( /
) directory 第1步:进入
public
文件夹,复制.htaccess
文件根目录( /
)目录
Step 2: Rename server.php
to index.php
in root folder 步骤2:将根目录下的
server.php
重命名为index.php
Step 3: Open vendor/laravel/framework/src/Illuminate/Foundation/helper.php
步骤3:打开
vendor/laravel/framework/src/Illuminate/Foundation/helper.php
Step 4: find code block 步骤4:查找代码块
function asset($path, $secure = null)
{
return app('url')->asset($path, $secure);
}
Replace it with 替换为
function asset($path, $secure = null)
{
return app('url')->asset('public/'.$path, $secure);
}
You are good to go.. :) 你已准备好出发.. :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.