简体   繁体   中英

Working locally to prepare for live server

I'm about to work on a new Codeigniter application locally. I'm curious as to my correct file structure I should be using which helps fit in with proper best practices. I have no changed the default root directory inside of MAMP. What I'm wanting to do is set up so that when I'm ready to upload to a live site there isn't anything additional I have to do so that it will work. I do have the index.php files configured so that it shows the correct location of the system and application folders. Site one is the main site.

Right now I have this:

Local

/MAMP
    /htdocs
        /sites
            /site1
                /system
                /application
                /public_html
                    index.php
            /site2
                /system
                /application
                /public_html
                    index.php
            /site3
                /system
                /application
                /public_html
                    index.php

LIVE

/root
    /application
    /dev
        /site1
            /application
            /system
            /public_html
                index.php
                .htaccess
        /site2
            /application
            /system
            /public_html
                index.php
                .htaccess
    /sites
        /site3
            /application
            /system
            /public_html
                index.php
                .htaccess
        /site4
            /application
            /system
            /public_html
                index.php
                .htaccess
    /public_html
        /public_html
            /assets
                /css
                /js
                /images
            index.php
            .htaccess
    /system

CodeIgniter has an environment variable in the root folder index.php that you set to determine whether your system is production or development. This is the index.php that routes all incoming requests.

Set this environment variable for your development machine, and have a separate file for your live server.

In application/config, you can store separate production and development configuration files under a folder named the same as your environment variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM