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条)

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)