Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Domain attached to category

edited July 2012 in Vanilla 2.0 - 2.8

The way my forum is setup, I have many categories and need to have a few of those categories act like their own site with their own domain name. For instance I would like "myforum.com/categories/example" be available from "example.com." Right now I have my domains forwarded to their respective categories where the url displays as "myforum.com/categories/example" after the user enters "example.com."

I would instead like the user to browse strictly in "example.com" except when leaving that category or going back to the site index. So basically that category needs to act as if it is its own vanilla installation with a mutual database with the main site. I do not however what to maintain multiple vanilla installations. My forum uses the Anonymouse plugin and therefore does not utilize any type of user accounts (if that makes doing this any easier).

I have done much research about this and it is easy enough to do with .htaccess when there is a physical subdirectory within the root directory. However I have not figured out how to make this work when there is no physical subdirectories to point to, such as the case here.

If anyone has done this on their own site or is an .htaccess expert, any help would be much appreciated.

Also, a similar situation would be if someone were to try and implement a subdomain for each category.

Best Answer

  • Options
    JeffDunneJeffDunne New
    edited July 2012 Answer ✓

    The way we handle this is to use a bootstrap.before.php file in the conf directory to set environment variables based on the domain name used to access the site. Each domain has it's own theme but we use just one Vanilla installation.

    To filter categories based on the domain, we set a DOMAIN_ID constant and have modified models to filter on this ID. Which means altering the core vanilla files & adding a column to the categories table.

    There might be simpler & cleaner way but this works for us.

    In the bootstrap.before file we set the CONF_PATH too so we have different config files for each domain. This way you can set different themes/banners/plugins/etc for each domain.

Answers

  • Options
    JeffDunneJeffDunne New
    edited July 2012 Answer ✓

    The way we handle this is to use a bootstrap.before.php file in the conf directory to set environment variables based on the domain name used to access the site. Each domain has it's own theme but we use just one Vanilla installation.

    To filter categories based on the domain, we set a DOMAIN_ID constant and have modified models to filter on this ID. Which means altering the core vanilla files & adding a column to the categories table.

    There might be simpler & cleaner way but this works for us.

    In the bootstrap.before file we set the CONF_PATH too so we have different config files for each domain. This way you can set different themes/banners/plugins/etc for each domain.

  • Options

    Thank you very much for your quick reply! It helped a lot, and I was able to successful modify the forum to do this.

    In addition to setting the DOMAIN_ID constant and setting the CONF_PATH, one thing I did different was instead of modifying the core files and adding a column to the categories table. I instead only modified the discussions controller. In the Index function, I tested whether DOMAIN_ID was defined and if so filtered the discussions to only display discussions from the appropriate category. When DOMAIN_ID is not defined all categories are included.

  • Options
    TimTim Operations Vanilla Staff

    @JeffDunne very very clever! I like it :)

    Vanilla Forums COO [GitHub, Twitter, About.me]

Sign In or Register to comment.