OSCLASS Tips : How to move OSCLASS website from live server to localhost development server ?


This post is about how to move OSCLASS website from live server to local development server. The process in a nutshell is pretty forward that is, to download the website files and put them in the local website directory, export database from the live server to the local server and update configuration files on development server. But there are some minute updates or changes required to let OSCLASS work on localhost development server, which we will see in brief in this post.


So, to download an OSCLASS website from live server to localhost development server, the following steps will be involved. For the purpose of this example, we shall download and deploy the website at "C:\xampp\htdocs\eadsprod" on Windows running XAMPP.
  • Download the website files from live server
  • Export Database from live server and import the database on the local development server
  • Update database details in OSCLASS config file 
  • Update HTACCESS file on local development server 
 Let's see the above major steps in brief:

  • Download the website files from live server
For the sake of this example, we assume that the website does not exist on the local development server. Therefore, we shall create a new directory under "C:\xampp\htdocs\" named "eadsprod". We shall download the OSCLASS files from live server and put them under the new "eadsprod" folder.


Using FTP Client or the file manager web interface provided by the web host, download the website files to the local development server. 

TIP: Downloading an archive is faster than smaller individual files
You may create an archive of "/httpdocs" (if OSCLASS website is not on subdomain or subdirectory) and download the archived "httpdocs.zip" via FTP client or the same web interface.
  
After the download, extract the archive and put the contents into  "eadsprod" at "C:\xampp\htdocs\".
  • Export Database from live server and import the database on the local development server
Login to web hosting control panel and access phpMyAdmin. Click on the database of the OSCLASS website and export. 
Access phpMyadmin on local development server and import the database SQL file downloaded. 
  • Update database details in OSCLASS config file
On the local development server, go to "C:\xampp\htdocs\eadsprod" and find "config.php" file. Open the "config.php" file in a text editor and add details of the database as per the local development server database details.

Edited Config.Php file looks like this:
<?php
/**
 * The base MySQL settings of Osclass
 */
define('MULTISITE', 0);

/** MySQL database name for Osclass */
define('DB_NAME', 'eadsprod');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'root');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Table prefix */
define('DB_TABLE_PREFIX', 'os_');

define('REL_WEB_URL', '/
eadsprod/');

define('WEB_PATH', 'http://localhost/
eadsprod/');
?>

The OSCLASS database configuration details above are as per the local development server. When OSCLASS database is moved from local to production server, the same details have to be edited as per the details of the database on the production server.

  • Update HTACCESS file on local development server
On production server, the OSCLASS website would be usually hosted on the root of the web server. But on a local development server running XAMPP or WAMP, we install websites on a separate directory under "/" or "htdocs". Therefore, slight changes is also required on the HTACCESS file. If there are major custom codes applied on the HTACCESS files used on production server, the same HTACCESS rules may not be applicable on the OSCLASS on the development server. In that case, we can use the default OSCLASS HTACCESS rules, which is:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
OSCLASS HTACCESS file from production server was:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Changed OSCLASS HTACCESS file on development server to:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
eadsprod/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /
eadsprod/index.php [L]
</IfModule>

Comparing the above two HTACCESS files, we see that on the development server, "eadsprod" have been included to "RewriteBase" and "RewriteRule " because on the local development server, the OSCLASS website if hosted from "/eadsprod".
Without the proper path edited in the HTACCESS file on thedevelopment server, the home page might open but internal links may not work properly.

Related Posts

Comments

Subscribe Our Newsletter