简体   繁体   中英

Copy Codeigniter project from Main domain to subdomain

I want to create a copy of my currently running codeigniter website , say http://www.example.com and place the copy in a new subdomain "beta" , say http://beta.example.com for test purposes and site modifications, so that the live site doesnt gets unmanaged due to the modifications.

So its about making a replica of website for test purposes and modifications under beta subdomain . How should I do it?

This is the file-structure I am having in beta subdomain

在此处输入图片说明

First use your cpanel to add a new subdomain: http://documentation.cpanel.net/display/ALD/Subdomains . While adding the subdomain you will have to enter its document root path.

If your website uses a database, then you need to create a new database using MySQL Databases option in cPanel. After creating a database and assigning a user to it, open phpMyAdmin, go to the original database, go to Operations tab in phpMyAdmin and copy that database to the new database you created.

Open File Manager and copy all the files related to your main website. Paste them in the subdomain's document root.

If your website uses a database, you will have to finally modify the database connection parameters in your site code. You can find the location of config easily through a grep command:

grep -r "mysql" /public_html/subdomain/

Now when you open http://beta.example.com you should see the replica website.

Use this htaccess file in ur main directory

for url like www.website.com

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php/$0 [PT,L] 

for your testing link like www.website/test use the following code

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /test/index.php/$0 [PT,L] 

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