2

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

enter image description here

divyang7
  • 309
  • 3
  • 10
  • 22
  • Oh since you use CodeIgniter, the db configuration should be in the file application/config/database.php – Ananth Jan 12 '15 at 09:44

2 Answers2

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] 
Tariq
  • 390
  • 1
  • 9
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.

Ananth
  • 4,227
  • 2
  • 20
  • 26
  • This error is showing up :You don't have permission to access / on this server. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. – divyang7 Jan 12 '15 at 09:53
  • 1
    Is your base_url set properly? http://stackoverflow.com/questions/11792268/how-to-set-proper-codeigniter-base-url – Ananth Jan 12 '15 at 09:56
  • base url is set according to main website – divyang7 Jan 12 '15 at 10:01
  • No, it should be set to the subdomain. – Ananth Jan 12 '15 at 10:07
  • If you still get the error, use your server's error log to find out the reason for 500 Internal Server Error, and then you need to correct it. – Ananth Jan 12 '15 at 10:08