laravel 部署到共享主机后无法查看某些页面
Unable to see some pages after laravel deployed into shared hosting
在共享主机中成功部署了我的 laravel 应用程序。
好吧,我也可以在服务器中看到一些页面。
但在服务器上看不到某些页面,但在本地主机上可以看到。
我已经尝试了许多可用的解决方案..但无法修复它。
domain.com/admin/home 可以在服务器上查看。
但是域。com/admin/postjob 在服务器上有 500 个错误,但在本地主机上工作正常。
Laravel文件夹复制到root下,laravel/public的内容复制到public_html/
让我们先检查路线。
//Admins Index Page
Route::get('/admin/home', 'admin\AdmhomeController@index')->name('admin.home');
//Job Posting by Admin - View
Route::get('/admin/postjob', 'JobsController@pjbyadm')->name('admin.postjob');
让我们看看控制器 - JobsController
//Post Job by Admin
public function pjbyadm(Request $request){
$auth = Auth::guard('admin');
if ($auth->check()){
//return view('admin.CRjob_ajob'); tried this first
return \view('admin.CRjob_ajob');
}
else {
return redirect('/mikeadmin');
}
视图的文件夹结构
资源 --> 管理员 --> CRjob_ajob
.htaccess 文件在 public_html 文件夹中如下所示。
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
AddType application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
服务器php文件有
//require_once __DIR__.'/public/index.php';
require_once __DIR__.'../public_html/index.php';
使用 laravel 5.8 版本。
预计会看到页面 admin/postjob,它在本地主机上运行良好。
在上传到服务器之前尝试 运行 php artisan cache:clear
然后重新上传或者其他解决方案是将其添加到您的路线
Route::get('/clear-cache', function() {
Artisan::call('cache:clear');
return "Cache cleared";
});
然后调用域。com/clear-cache
在共享主机中成功部署了我的 laravel 应用程序。 好吧,我也可以在服务器中看到一些页面。 但在服务器上看不到某些页面,但在本地主机上可以看到。
我已经尝试了许多可用的解决方案..但无法修复它。 domain.com/admin/home 可以在服务器上查看。 但是域。com/admin/postjob 在服务器上有 500 个错误,但在本地主机上工作正常。
Laravel文件夹复制到root下,laravel/public的内容复制到public_html/
让我们先检查路线。
//Admins Index Page
Route::get('/admin/home', 'admin\AdmhomeController@index')->name('admin.home');
//Job Posting by Admin - View
Route::get('/admin/postjob', 'JobsController@pjbyadm')->name('admin.postjob');
让我们看看控制器 - JobsController
//Post Job by Admin
public function pjbyadm(Request $request){
$auth = Auth::guard('admin');
if ($auth->check()){
//return view('admin.CRjob_ajob'); tried this first
return \view('admin.CRjob_ajob');
}
else {
return redirect('/mikeadmin');
}
视图的文件夹结构 资源 --> 管理员 --> CRjob_ajob
.htaccess 文件在 public_html 文件夹中如下所示。
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
AddType application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
服务器php文件有
//require_once __DIR__.'/public/index.php';
require_once __DIR__.'../public_html/index.php';
使用 laravel 5.8 版本。
预计会看到页面 admin/postjob,它在本地主机上运行良好。
在上传到服务器之前尝试 运行 php artisan cache:clear
然后重新上传或者其他解决方案是将其添加到您的路线
Route::get('/clear-cache', function() {
Artisan::call('cache:clear');
return "Cache cleared";
});
然后调用域。com/clear-cache