Osclass has very powerful feature that allows you to setup subdomains based on your data (dynamical subdomains).

Subdomain types:

  • User based subdomains
  • Category based subdomains
  • Location based subdomains. This includes country, region and city

Let’s start

  • Log in to your hosting backoffice or control panel (cPanel)
  • Go to the subdomains section and create new subdomain
  • Enter star sign (*) as subdomain name
  • Go to your file system or FTP open config.php located in root folder of your osclass installation
  • Change:
define('WEB_PATH', 'https://yourdomain.com/');

Into:

define('WEB_PATH', 'https://' . $_SERVER['HTTP_HOST'] . '/');
  • Save updates made in config.php
  • Log in to your Oc-admin
  • Go to Settings > Advanced
Subdomains configuration
  • Select your subdomain type in the select box and press “Save changes” button

Now you have subdomain based classifieds!

Data used in subdomains

You may wonder what kind of data are used to create subdomain URL, especially what is replaced by “*”

  • User based – username field from user profile is used. That is also reason why username must be unique. Example: johndoe.domain.com
  • Category based – category slug is used, also must be unique. Example: cars.domain.com
  • Country based – country slug is used. Example: united-states.domain.com. You might want to change slug to have it like us.domain.com
  • Region based – region slug is used. Example: alabama.domain.com
  • City based – city slug is used. Example: los-angeles.domain.com