Blog Sections Open

Running City Subdomains from One Evolution CMS Structure

A multisite routing pattern for city-based subdomains built on one Evolution CMS installation.

One of the more useful classic Evo patterns is the city-subdomain setup: the same site structure is reused for several city branches, while each subdomain maps to its own top-level resource. That keeps the project in one installation without duplicating every template and snippet.

Target structure

The model is simple:

  • example.com/about.html
  • city1.example.com/about.html
  • city2.example.com/about.html

Each city exists as a top-level resource, and the request host determines which branch should be treated as the active root.

Typical rewrite layer

RewriteCond %{HTTP_HOST} ^([a-zA-Z\-]+).site-example\.com$ [NC]
RewriteRule ^robots.txt robots-%1.txt [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^([a-zA-Z\-]+).site-example\.com$ [NC]
RewriteRule ^(.*)$ index.php?q=/%1/$1 [L,QSA]

Typical Evo-side routing

A plugin on OnWebPageInit can detect the subdomain, find the matching root resource by alias, and forward the request if needed. A second step on OnParseDocument can then normalize the final links so the city alias is not duplicated in output.

Why this pattern works

You get one codebase, one set of templates, and one content tree, while still presenting each city as a separate host. It is especially useful for service sites whose pages are structurally identical across regions.

What to keep clean

  • Subdomain aliases must be stable and unique at the top level.
  • 404 behavior should fail early if the city alias does not exist.
  • Generated links should be normalized after routing so visitors see clean host-based URLs.

For Evo-based regional projects this remains one of the clearest ways to get multi-city behavior without maintaining fully separate sites.

Newer post

Applying Watermarks Automatically During Uploads with Watermarker

How to use the Watermarker plugin to add watermarks during file uploads in Evolution CMS instead of post-processing images manually.

Older post

Building a Price Range Filter for Ditto with andFilter

How to implement an “from-to” price filter for Ditto output when product prices are stored in TV fields and need range-based selection.