dsz90288 2016-09-26 12:00
浏览 77
已采纳

将PHP站点上传到Web,只有索引页面可用

I uploaded my site for the first time to an ipage hosting. There was no public_html folder, and the root directory is actually public so I uploaded all of my website folders to it, and gave open viewing permissions only to my public files. Now my home page is working and the rest of the isn't and I think it has something to do with the location of the files that is now different than when it was local, because of the structure of the ipage directories. The error I get is 'Page not found'.

This is an example from my route.php file:

Route::get('/', 'PagesController@index');
Route::get('store', 'StoreController@index');

(home page works, store doesn't).

Controllers example:

class PagesController extends MainController
{
public function index()
{   
    self::$data['title'] = 'Ayala & Tamar | Home Page';
    return view('content.home', self::$data);       
}


 class StoreController extends MainController
{
//Getting dynamic categories
public function index()
{ 
 self::$data['title'] = 'Ayala & Tamar | Store';
 self::$data['categories'] = Category::all()->toArray();
 return view('content.categories', self::$data);   
}

All my Laravel and PHP structure stayed the same and is in the main project directory, except for the public files which are no longer in the public folder, they are directly in the main directory.

Does anyone have an idea for a solution? Thanks!

  • 写回答

2条回答 默认 最新

  • douhong4452 2016-09-26 12:05
    关注

    Set route like this, so your route.php file look like this

    Route::controllers([
      'store' => 'StoreController'
    ]);
    
    Route::get('/', 'HomeController@index');
    

    Your controller

    class StoreController extends Controller
    {
      public function getIndex(Request $request)
      {
        self::$data['title'] = 'Ayala & Tamar | Store';
        self::$data['categories'] = Category::all()->toArray();
        return view('content.categories', self::$data);   
      }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services