Creating a Joomla! Demo Website that is recreated periodically

Often you will find Joomla! based demos at programmer and developer’s websites, which are automatically recreated every hour or so, to make sure that the demo site is available for new visitors to get a clean environment to try out things. Here is a tutorial on how you can create your own demo site using Joomla that is recreated automatically and periodically

You will need the following to proceed:

  • Root access using terminal software like Putty or Nexus or something similar, to your server, where the website will be hosted or FTP access or File manager access to your website
  • Control Panel access to your website

In the following example, we will create a demo website for, which will be accessed using the URL – and accessed by absolute path at /home/{username}/public_html/mydemo

Step-1: Create new MySQL databases

  • Create a new database by name mydemo
  • Create a new database by name shadow
  • Create corresponding mysql users for each of these databases and associate them with these databases with necessary priveleges. For example, create usernames as mydemo_user with password pass1word and shadow_user with password pass2word

Step-2: Create the shadow demo website

  • Create folders named shadow and mydemo under public_html (or httpdocs as the case may be) of your main website
  • Download and install the latest version of Joomla! 1.5 on Make sure that you install Joomla 1.5 on the shadow database
  • Install additional components, modules, plugins and create the required menu items as needed in this Joomla! installation and finally check everything for completeness and correctness
  • Configure your extensions the way you want them to be used as demo. Remember that, the visitors in the demo are supposed to be editing the configuration of your component at backend and play around with it. So make the configuration as minimal as possible.
  • The should have everything configured as you will need in the demo website

Step-3: Secure your shadow website

  • Login to admin backend of, go to Global Configuration and disable FTP
  • Using User Manager, change the username of the Super Administrator account. Do not have this as admin. Rename it to something only you will know. Also make sure that, you change the password to something very obscure and known only to you
  • Using User Manager, create a new user account with username and password as demo. Please note that this user must have Manager level access to the website.
  • Now browse through the frontend and backend pages and make sure that everything is fine about Joomla and your extensions

Step-4: Create and Edit configuration files

  • Using file manager or root access, create a copy of configuration.php in /home/{username}/public_html/shadow. Name this file as, configuration_mydemo.php
  • Using file manager or root access, create a copy of the htaccess.txt in /home/{username}/public_html/shadow. Name this file as, htaccess_mydemo.txt
  • Open /home/{username}/public_html/shadow/configuration_mydemo.php and edit the values for the variables – $log_path, $tmp_path to reflect the paths for mydemo, instead of shadow website.
  • In configuration_mydemo.php, edit the values for $user, $db and $password to values associated with the mydemo database and save the file

Step-5: Create restoration scripts and folders:

  • Go to your home directory on your server – /home/{username} and create a folder by name demo_restore. Its very important that, this folder is not accessible by URL or is not under public_html folder.
  • Create a file by name and add the following contents to it:


rm -rf ${DEMO_PATH}/*
cp -pr ${DEMOR_PATH}/* ${DEMO_PATH}/
mv -f ${DEMO_PATH}/configuration_mydemo.php ${DEMO_PATH}/configuration.php
mv -f ${DEMO_PATH}/htaccess_mydemo.txt ${DEMO_PATH}/htaccess.txt

mysqldump -u${DEMOR_SQL_UN} -p${DEMOR_SQL_UP} ${DEMOR_SQL_DB} > ${TMP_PATH}/shadow.sql
mysql -u${DEMO_SQL_UN} -p${DEMO_SQL_UP} ${DEMO_SQL_DB} < ${TMP_PATH}/shadow.sql echo `date +%s` > ${TMP_PATH}/restored_on.txt

Save the file and chmod to 755.

Step-6: Add cron job to run periodically

  • Go to “Cron Jobs” facility in your hosting control panel
  • Add a cron job, such that, the is invoked or run once every hour, or as per your desired interval. Following cron job entry fires, once every hour

0 * * * * /bin/sh /home/{username}/demo_restore/

With the above changes, you will find that, your demo site ( will be recreated every hour from the content (database and files) available in website. So any changes that you want to make to the demo site after it is up and running, must be made to The changes will be available at mydemo website with in the next 1 hour!

We hope this steup will help you in creating a demo website for your business. For any comments or questions, please add your comment to this blog post.

If you really appreciate us sharing this, you may please bookmark this blog and share it with all your friends and community and help others too

PS: We provide the above procedure with no cost or fee and do not guarantee that this will work always. We request you to take a backup of existing home directory on your server, before you attempt the above setup. Please use this at your own risk.