问题
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
回答1:
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.
回答2:
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]
来源:https://stackoverflow.com/questions/27898861/copy-codeigniter-project-from-main-domain-to-subdomain