Updates from juanramon Toggle Comment Threads | Keyboard Shortcuts

  • juanramon 3:12 pm on July 19, 2013 Permalink | Reply  

    Use categories, countries, regions or cities as subdomains 

    It’s not plug and play configure Osclass or any other service to work with multiple subdomains. There are three steps:

    • DNS Wildcard
    • Apache Wildcard
    • Osclass subdomain configuration

    DNS Wildcard

    First of all you need to let know to the whole internet which IP resolve any of your subdomains. So, region.example.net will resolve the same IP as region2.example.net.

    In the examples I will use as your IP server and as a domain example.net. You should replace this values for your IP and domain. Furthermore, I’m not sure if the following solutions varies depending the DNS Manager you use but here I put two examples:


    *.example.net.    A


    As you can see the value you have to change is the A record. Finally, if you have another subdomain pointing to another IP, you should just specify it before the *.

    Once you’ve done this, it could take up to 24 or 72 hours to take

    Apache Wildcard

    I’m not sure how it can be done in each specific hosting service, so I would explain what you have to specify in the VirtualHost configuration.

    <VirtualHost *:80>
        ServerName example.net
        ServerAlias *.example.net
        CustomLog /var/log/apache2/example.net_access_log combined
        ErrorLog /var/log/apache2/example.net_error_log
        <Directory /var/www/example.net/web>
            Options -Indexes FollowSymLinks -MultiViews
            AllowOverride All
            Order allow,deny
            allow from all

    What we’re saying with this configuration is that all the petitions that come to any subdomain of example.net will go to the folder where Osclass is installed.

    Changes in config.php

    In order to accept any subdomain, Osclass’ config.php have to be modified, the line that contain the WEB_PATH have to be changed to


    define('WEB_PATH', 'http://'.$_SERVER['HTTP_HOST'].'/path/to/Osclass/');


    Cookies configuration

    Cookies have to be set to accept all subdomains as only one website, change your php.ini file, search for the line

    session.cookies_domain =


    and change it to


    session.cookies_domain = .domain.tld

    Note: From Osclass 3.3 and newer versions, if you’re not able to modify your server’s configuration files, you could define COOKIE_DOMAIN in the config.php

    define('COOKIE_DOMAIN', '.domain.tld');


    Note: It’s important to have a “.” (dot) before the domain. Do not include “www” or anything else.


    Osclass subdomain configuration

    Now we have to specify which type of subdomain we want: categories, countries, regions or cities. You can change this configuration in your oc-admin > Settings > Advanced.

    Let me know if you have problems with your configuration in the comments of this post.

    • BbuySell 7:45 pm on July 26, 2013 Permalink | Reply

      i am new here so i need to know details about Osclass subdomain configuration, how to setup and how to use…please help me…

    • Elvis 10:21 pm on July 27, 2013 Permalink | Reply

      Hi Juan,
      I think i managed to configure step 1 (DNS Wildcard.) But im having a lot of trouble with step 2 (Apache Wildcard)

      This is what i’ve done so far: I added an A Record from my hosting service (HostGator) as *.mywebsite.com, along with my hosting’s/site IP address.

      But how do I find this Apache Wildcard? Is it hidden somewhere in my hosting service (HostGator?) or is it something I access through my FTP client? I have no idea how to even get started on this Apache Wildcard step. Can you offer some more details please?

    • Andrei 2:09 pm on July 29, 2013 Permalink | Reply

      “Now we have to specify which type of subdomain we want: categories, countries, regions or cities. You can change this configuration in your oc-admin > Settings > Advanced”

      Hi !

      I cannot find the Advanced TAB in admin, i looked for it, but it`s not there, is it possible to have some problems with the platform ?


      • _mahesh 3:02 pm on October 21, 2013 Permalink | Reply

        it will appear in osclass 3.2.1 , mouse over on settings icon in admin panel there you will see advanced link , if your current version is below the version 3.2.1 you have to upgrade to it

    • Umair Khan 3:44 pm on August 15, 2013 Permalink | Reply


    • Umair Khan 12:48 pm on August 16, 2013 Permalink | Reply

      Can any Expert make Video Tutorial of it ? and can upload it on Youtube ?

    • RayJay 10:18 pm on August 20, 2013 Permalink | Reply

      there are two issues with subdomain feature

      1- The city names with sapce are not converted into subdomain
      2- User is asked to login again when he moves from main domain to subdomain.. [session.cookies_domain = .domain.tld] still does not fix the issues.

    • tausif 7:04 am on August 21, 2013 Permalink | Reply

      i have everything but i see error at my subdomain see here mumbai.offersvalley.in

    • jesus 4:11 am on August 22, 2013 Permalink | Reply

      do you have a demo or something to see hows it works?

    • clau 3:00 am on August 28, 2013 Permalink | Reply


      Can someone help me with the region subdomains?
      I have hosting with hostgator and i added a DNS wildcard, modified the config file, disabled/enabled friendly links, and selected the region from settings->advanced.

      My domain is not primary domain, it is a addon domain, is it possible that this is the problem?

      Please let me know what should i do, http://postezi.ro/
      Thank you!

    • Karthik 10:32 pm on October 25, 2013 Permalink | Reply

      Works Perfectly, Check http://www.addque.com/ city based sub domains.

      I done the first two steps long before, but not came across the WEB_PATH and cookies work, now I have done it and the sub domains works perfectly.

      • TMKHAN 3:02 pm on January 4, 2014 Permalink | Reply

        Hi Karthik
        Seen you ad site. It has a clean theme. Which theme are you using or you have designed your own. Can you please guide are you using same DB for all city subdomains? Do all city subdomains have speraate osclass installations, if one then how?

    • Karthik 10:41 pm on October 25, 2013 Permalink | Reply

      A small suggestion for Apache Wildcard, if you were in shared hosting where custom Apache configuration is not allowed, you can simply create a sub domain with *.yourdomain.com and point it to public_html. Simple.

      Proof : my site’s Apache Wildcard is done by above said method and it works.

      • alfa 12:19 am on February 10, 2014 Permalink | Reply

        Hi Karthik,
        Nice site. 2 related questions:
        1. Are you using the same DB for all city subdomains?
        2. If a user is registered with http://agra.addque.com/, does the user need to reregister to use post in another city subdomain, eg. http://akola.addque.com/


    • _mahesh 4:30 pm on October 30, 2013 Permalink | Reply

      can any one tell me how to change in config.php , i am confusing with /path/to/osclass/ what i have to replace in that…..give with example……..it urgent…thanks

    • _mahesh 6:38 am on October 31, 2013 Permalink | Reply

      Hi ,
      I got two problems while i am trying to get city subdomains, iam having two subdomains

      1) i did not get common login for the subdomains…user gets asked to login again while he goes to subdomains

      2) Please clarify the which data i have to insert in the host in advanced settings in at admin

    • IM Classified 6:27 pm on November 26, 2013 Permalink | Reply

      Hello Jesus ….. Yes I have a demo at http://www.imclassified.com/ . If you have any query please do let me know.. Its working fine apart from individual post. Its not redirecting to cityname.imclassified.com/post-url….. sub-domain rather than http://www.imclassified.com/post-url…... I dont know how to solve it. if someone have solution pls do let me know..

    • Yash 11:30 am on January 7, 2014 Permalink | Reply

      If I do the config file setting as described here in version 3.3.2, I cant login to OC-admin. I think the problem is with the java script path. It was working in osclass 3.0 .

      Pls advice


    • India free classifieds 2:46 pm on January 14, 2014 Permalink | Reply

      can you have the detailed screen shot step by step to fix this .


    • India free classifieds 3:37 pm on January 14, 2014 Permalink | Reply

      how to config in hostinger.in hosting panel , for

    • Yash 8:34 am on January 21, 2014 Permalink | Reply

      Hi all,
      I think version 3.3.2’s sub domain configuration screwed up this great project, unfortunately nobody even in the forums are responding to this matter. Sub domain configuration , common user login for different sub domains, admin login everything is geting problem if you configure the sub domain.
      Someone’s help is highly appreciated.


      • _CONEJO 9:08 am on January 21, 2014 Permalink | Reply

        Login problem in different subdomains is probably caused by an incorrect cookie configuration. Did you follow the guide? It’s explained there.

        • keerthisone 2:25 pm on March 27, 2014 Permalink | Reply

          Conejo i followed the steps mentioned above, the subdomain working but i could not login into my admin account. my site is http://www.sellrbuyr.in.

        • Mehmood 9:13 am on June 14, 2014 Permalink | Reply


          I would like osclass to work with both Region and city specific subdomain.

          Suppose Country X has three regions A,B & C. And each Region has its own cities. Say Region A has city 1, city 2 and city 3. I want sub domain to be region specific and at the same time city specific.. Suppose my website is unx.com. Now i want that if i have use subdomain (regionA.unx.com) then it should show me ads from all cities of region A. And also if i select (City1.unx.com) then it should show me ads from only city 1.

          Right now in Osclass we can either go for city specific sub domain or region specific. And i feel this is an important feature that need to be added.

          If someone has already worked out a solution for this, please share the same.


    • Yash 7:48 am on January 22, 2014 Permalink | Reply

      I have installed the script in public_html/domain folder/ and this site is directly pointing to this folder. I have edited A record for wild char * and in config.php

      define(‘WEB_PATH’, ‘http://’.$_SERVER[‘HTTP_HOST’].’/’);

      define(‘COOKIE_DOMAIN’, ‘.domain.tld’);

      The sub domain is working fine but the problem is I cant login to admin anymore. But in older version it was working fine.

      Thanks for your time and consideration


      • Serma raj 2:19 pm on April 13, 2014 Permalink | Reply

        Same problem here bro…..subdomains working fine. but cant login to admin

    • gumpul 9:35 pm on February 26, 2014 Permalink | Reply

      can i use multiple subdomins at once ?

      as of now we can choose only any of one option like catrgories or citis or countries to set domains

      but i want to use like

      categories and cities and countries combination how to make it ??

    • Anilkumar Astra 11:25 pm on March 10, 2014 Permalink | Reply

      can i enable subdomians for multiple locations at once ?

      Now we just can choose country or region or city or category unlike this

      can i set subdomain for all at once ??

    • Anilkumar Astra 6:47 pm on April 10, 2014 Permalink | Reply

      can i configure subdomain for both cities and countries at once ?

    • mandi007 10:09 am on April 12, 2014 Permalink | Reply

      the sub domain is working for me but same problem i cant login to admin and also i cant post new post…………but no help to solve it

    • Anilkumar Astra 7:31 pm on April 12, 2014 Permalink | Reply

      hello friends use this

      define(‘WEB_PATH’, ‘http://’.$_SERVER[‘HTTP_HOST’].’/’);

      as webpath in config.php

    • Anilkumar Kanneboina 10:47 pm on April 22, 2014 Permalink | Reply

      shall i use city & country subdomain at a time?

    • Orova 6:19 am on May 7, 2014 Permalink | Reply

      Hi I am using country based sub-domain when I select a country, in “Other searches that may interest you” it shows regions of other countries also. I want to show regions of only active country. how to do this? thanks in advance… Also country name not showing in page title.

    • Anilkumar Kanneboina 9:29 pm on June 27, 2014 Permalink | Reply

      after following your instructions my webpage showing blank :P?

    • Daniel 12:33 am on July 31, 2014 Permalink | Reply

      My subdomains works fine, but no show the items filtered by region, any idea?

    • govindak 12:58 pm on August 7, 2014 Permalink | Reply

      can i enable subdomians for multiple locations at once ?

      Now we just can choose country or region or city or category unlike this

      can i set subdomain for all at once ??

      any body got it working ?

    • Subhojit Mukherjee 1:32 pm on October 6, 2014 Permalink | Reply

      If you are a cPanel user then don’t try step 1 & 2. Go to cPanel “Subdomains” tab and create a subdomain, name it *.yourdomain.yourTld and point it to your osclass installation directory.

    • Ayesha Mirza 12:41 am on October 16, 2014 Permalink | Reply

      hello dears, please help me anyone and tell me how to Use categories, countries, regions or cities as subdomains i don’t understand how to make cities as subdomains Thanks

    • Al-tutor 8:20 pm on October 23, 2014 Permalink | Reply

      hi, I liked the post, it was a great work, but I’m thinking of another idea, not sure if it is possible, if i had one ad space on a blog but two banner to show, and i want to show banner1 to a specific country, and the second for the remaining countries! is it possible?
      It would be great if you answer me! ^^’

      thnx in advance.

    • Ajit Sahane 6:26 pm on December 7, 2014 Permalink | Reply

      Hi guy’s – i solved city wise sub-domain issue. check my website – http://www.classifiedsguru.in/ and sub-domain http://chennai.classifiedsguru.in/

      for setup sub-domain kindly contact personally – info@webhostpune.com / 9762105756

    • Ajit Sahane 3:42 am on December 8, 2014 Permalink | Reply

      hi guy’s DNS Wildcard implement work perfectly need to some other changes. here is my site
      http://patna.classifiedsguru.in/ once user login then hi can post ads any sub-domain without logout and admin normally access there admin panel. thanks to osclass team.

    • abyanetwork 8:45 pm on December 29, 2014 Permalink | Reply

      How to do that with cpanel ?

    • Kim Chu 5:09 am on January 17, 2015 Permalink | Reply

      if my osclass installation is under /public_html/mysite.com/ folder
      what will be my web path configuration

      define(‘WEB_PATH’, ‘http://’.$_SERVER[‘HTTP_HOST’].’/mysite.com/’); ?

    • Shubham Takodes 9:23 am on April 14, 2015 Permalink | Reply

      Its not working

  • juanramon 1:43 pm on October 22, 2012 Permalink | Reply
    Tags: database, host, mysql, port, port-number   

    MySQL alternate port number 

    If your host uses an alternate port number you just need to add it after the mysql host name constant: DB_HOST. For example:

    define('DB_HOST', 'localhost:3300');

    Another example:

    define('DB_HOST', 'mysql.dreamhost.com:3300');
    • Dan 9:17 am on October 24, 2012 Permalink | Reply

      Thanks for the information! I was testing Osclass with MAMPP at localhost, so the mysql default port was the 8889 and I didn’t know how to fix the problem. Cleaner that than change the default mysql port!

  • juanramon 6:56 pm on August 20, 2012 Permalink | Reply
    Tags: hooks, item-hooks, posted_item   

    Redirect to a landing page after adding a new listing 

    In certain cases, you want to redirect to a specific page after adding a new listing. You can get that result using the posted_item hook. Example:

        function redirect_to_landing($item) {
            header('Location: ' . osc_static_page_url()); exit;
        osc_add_hook('posted_item', 'redirect_to_landing');
        // add this code in the functions.php of your theme

    The code from above would redirect to a static page that has publish_ok as a slug. So, remember that you will have to create first that static page.

    The next example will redirect to the listing page:

        function redirect_to_landing($item) {
            View::newInstance()->_exportVariableToView('item', $item);
            header('Location: ' . osc_item_url()); exit;
        osc_add_hook('posted_item', 'redirect_to_landing');
        // add this code in the functions.php of your theme

    The hook posted_item it’s available since the version 2.0.

    • DrLightman 4:32 pm on May 21, 2014 Permalink | Reply

      Thanks, it works

    • Stiffe 4:58 pm on October 9, 2014 Permalink | Reply

      In the first example, what do you mean with “a slug”? (need explanation)

      I have tried to make a static page in osclass adminpanel, with “publish_ok” as an internal name
      and inserted that code to my actual theme’s functions.php.

      And I have also tried the second alternative.

      None of them are working with Boxer theme.

    • hostyasui 9:36 am on December 17, 2014 Permalink | Reply

      not working for logged in users

  • juanramon 10:47 am on July 13, 2012 Permalink | Reply
    Tags: , translations   

    You can translate the last available themes in translate.osclass.org:

    If you don’t already have your account in translate.osclass.org, fill the form and we’ll get back to you soon 🙂

  • juanramon 10:36 am on July 10, 2012 Permalink | Reply
    Tags: pagination, styles   

    Pagination in v3.0 

    In v3.0 there are some changes regarding the pagination class. Now it’s a <ul> structure, so the pagination would be something like this:

        <li><span class="searchPaginationSelected list-first">1</span></li>
        <li><a rel="nofollow" href="http://domain.tld/category/2" class="searchPaginationNonSelected">2</a></li>
        <li><a rel="nofollow" href="http://domain.tld/category/3" class="searchPaginationNonSelected">3</a></li>
        <li><a rel="nofollow" href="http://domain.tld/category/4" class="searchPaginationNext">4</a></li>
        <li><a rel="nofollow" href="http://domain.tld/category/5" class="searchPaginationLast list-last">5</a></li>

    Furthermore, now the selected page it’s not a link. The main reason it is to not mislead google, because we were linking to the same page. So, we’re using a <span> tag instead of link .To sum up, remember to modify properly your css to show in a line the pagination.

    For example: .paginate ul li { display: inline; }

    You must upgrade this in your themes in order to work properly in v3.0.

    • gian luca 12:23 am on July 16, 2012 Permalink | Reply

      hello, where do i have to make this changes?

      • juanramon 10:54 am on July 17, 2012 Permalink | Reply

        In the style.css file. If you’re using some theme already available in market.osclass.org/themes and it doesn’t looks well, don’t worry, we’re going to update the themes during this week 🙂

    • Carlos 1:00 am on December 11, 2012 Permalink | Reply

      how to show all the ads in pagination the current limit is 100 in modern theme

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc