Copy Codeigniter project from Main domain to subdomain

半世苍凉 提交于 2019-12-11 02:36:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!