codeigniter and cpanel installation

前端 未结 2 1453
暗喜
暗喜 2021-01-23 00:29

I am completely new to moving codeigniter to my web-server and im having trouble with the configuration. Where do I place my codeigniter project folder in www under myurl.com in

2条回答
  •  生来不讨喜
    2021-01-23 00:55

    Directory structure

    If at all possible, it's advised that you keep your system and application folders above the web root. Your index.php file needs to be accessible from a browser, so that should go in your public_html folder. Here's a possible directory structure that you could use:

    -/home/edd
        -public_html
            -index.html
            -.htaccess
        -system
        -application
    

    You can rename your system and application folders, or create another sub-directory to put them in, if you want.


    index.php

    Within index.php you'll need to update $system_path and $application_folder to reflect the location and name of your system and application folders. You can use an absolute path or a relative path. Relative path shown below:

    $system_path = '../../system';
    $application_folder = '../../application';
    

    .htaccess

    The first two sections of your .htaccess file are there to prevent a user from accessing your system and application folders. If you're storing them above the web root then you don't really need this. If you keep them, then you need to update the paths. This file should be located in your public_html folder.


    application/config/config.php

    As you've already correctly done, the index.php value should be removed from the index_page config, so index.php can be removed from your url using your .htaccess file;

    $config['index_page'] = 'index.php';
    

    should be changed to:

    $config['index_page'] = '';
    

    You may also have to make this change:

    $config['uri_protocol'] = 'REQUEST_URI';
    

    (If you have no luck with this value, try the others. One should work!)


    application/config/routes.php

    $route['default_controller'] = "home_controller";
    

    (Assuming that is the name of your controller.)


    Your site is likely to depend on some assets, such as CSS and JavaScript. These should go in your web root - public_html. You can organise these file however you like.

提交回复
热议问题