Building a Custom Site Quick Start

Документация / Инструкции и типовые решения / Building a Custom Site Quick Start

Any website engine installation is normally an easy task. With a certain amount of skill this routine is usually completed quickly and without complications. Cotonti is no exception.

Эта страница еще не переведена на русский. Отображен оригинал страницы на английском языке. Вы можете зарегистрироваться и помочь с переводом.

Installation for a particular website type, however, has some specifics that newbies and even experienced users do not know of or do not take into account. This small article describes Cotonti installation step-by-step and, hopefully, offers some valuable information for the Cotonti community.

#1. Step 1. Prepare Remote Host

Hosting plans and tariffs differ, so here we give you a full freedom to:

  • Setup the domain
  • Create GIT or SVN repository

#2. Step 2. Prepare Cotonti Package

First download the package at and unpack it into the local folder of choice.

Now we proceed to the primary web engine configuration. Copy the contents of sef-urls.htaccess into the still empty .htaccess and add the www / non-www redirect:

RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

So as not to come back to .htaccess we add two more strings:

RewriteRule ^sitemap.xml?$  index.php?r=sitemap [QSA,NC,NE,L]
RewriteRule ^sitemap$  page.php?c=system&al=sitemap [QSA,NC,NE,L]

First one is required for the XML sitemap and the other one lets you create and use a system page with “sitemap” alias for a normal HTML sitemap.

The finalized .htaccess should look like this:

# Rewrite engine options
Options -Indexes
RewriteEngine On
# Server-relative path to Cotonti
# Replace it with your path if you run Cotonti in a subfolder
RewriteBase "/"
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]
# Language selector
RewriteRule ^(en|ru|de|nl)/(.*) $2?l=$1 [QSA,NC,NE,DPI]
# Admin area and message are special scripts
RewriteRule ^admin/([a-z0-9]+) admin.php?m=$1 [QSA,NC,NE,L]
RewriteRule ^(admin|login|message)(/|\?|$) $1.php [QSA,NC,NE,L]
# System category has priority over /system folder
RewriteRule ^system/?$  index.php?rwr=system [QSA,NC,NE,L]
RewriteRule ^sitemap.xml?$  index.php?r=sitemap [QSA,NC,NE,L]
RewriteRule ^sitemap$  page.php?c=system&al=sitemap [QSA,NC,NE,L]
# All the rest goes through standard rewrite gateway
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]+) index.php?rwr=$1 [QSA,NC,NE,L]

One last thing left in the root folder is modification of robots.txt. We just add the host directive:

User-agent: *
Disallow: /datas
Disallow: /images
Disallow: /js
Disallow: /lang
Disallow: /lib
Disallow: /themes
Disallow: /system

If you’re planning to use the URL Editor plugin and modify a preset, copy it into datas/urltrans.dat. This would save your settings from accidental overwriting during the website engine upgrade.

This is also a good time to alter URL modification settings. If, in instance, you prefer to have trailing slashes in category URLs, you should change

page	c=*	{cot_url_catpath()}


page	c=*	{cot_url_catpath()}/

This way category and page URLs would look different for search engines.

#3. Step 3. Prepare the Theme

Since we’re going to build a new the theme from scratch, we should use Nemesis theme as a model. Once it has been copied into a “themename” folder, rename the following files:

  • nemesis.php
  • nemesis.en.lang.php
  • nemesis.rc.php


  • themename.php
  • themename.en.lang.php
  • themename.rc.php

In the themename.php change the theme name from Nemesis to whatever name you got for it. I would strongly recommend not skipping theme cloning step so as to save it from accidental overwriting during future upgrades.

#4. Step 4. Upload the Package

This is simple – deploy the package in a preferable way: repository or FTP client.

#5. Step 5. Initial Setup

Any attempt to open Cotonti-powered website with missing config.php starts Cotonti installer. All operations here are pretty much understandable and normally do not cause any problems. All you have to do is provide MySQL server address, database name, user and password.

Next comes extensions selection. The choice here depends on the website type and overall requirements, in each case the list would be different. Couple of things shall be kept in mind:

  • Any module and plugin can be paused, uninstalled and reinstalled at any time.
  • Third party extensions can be added to the list, installed, uninstalled and removed at any time.
  • There exist dependencies according to which some extensions require other extensions to run. Cotonti tracks such dependencies and lets you know if a required module or plugin is missing or not installed.

Last thing to do here is specify Superadmin login and password.

Once the installation routine is finished, there are three more operations to complete:

If GIT repository is used, exclusions specified in .gitignore shall be uploaded manually via FTP (i.e. urltrans.dat).

Caching should be disabled in config.php so that all changes at the development stage could be visualized immediately:

$cfg['cache'] = FALSE;			// Enable data caching
$cfg['cache_drv'] = '';			// Cache driver name to use on your server (if available)
								// Possible values: APC, eAccelerator, Memcache, Xcache
$cfg['xtpl_cache'] = FALSE;		// Enable XTemplate structure disk cache. Should be TRUE on production sites

Delete install.php until next update.

#6. The Summary

We have prepared Cotonti Siena package for the development stage. The next actions would differ depending on the website type and requirements. I’ll describe those later in the coming tutorials.

Комментарии отсутствуют
Добавление комментариев доступно только зарегистрированным пользователям