• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Different style per domain (code example) 1.x

No permission to download

Jake Bunce

XenForo moderator
Staff member
#1
Jake Bunce submitted a new resource:

Different style per domain (version 1.x) - A code example for overriding the style choice of the user, in this example by domain name.

I made this simple addon to override the style choice by domain name. You need to edit the library/StyleOverride/Listen.php file to specify the domains and their style_ids:

Code:
<?php

class StyleOverride_Listen
{
	public static function listen(XenForo_Controller $controller, $action)
	{
		$visitor = XenForo_Visitor::getInstance();
		$host = $controller->getRequest()->getServer('HTTP_HOST');

		if ($host == 'www.domain1.com')
		{
			$visitor['style_id'] =...
Read more about this resource...
 

DRE

Well-known member
#6
The domains would all be parked on the same site. So it's one install of XF that can be accessed by multiple domains.
I have two xenforo forums. I don't have time to work on the other one. Parking a domain is basically redirecting it to another site right? So basically, if I bring over all the members from that site to my 8th legion site, I can redirect members from my blackgamer.net site so that they are on the 8th legion but viewing it through a style i had created for blackgamer.net?
 

Jake Bunce

XenForo moderator
Staff member
#7
I have two xenforo forums. I don't have time to work on the other one. Parking a domain is basically redirecting it to another site right? So basically, if I bring over all the members from that site to my 8th legion site, I can redirect members from my blackgamer.net site so that they are on the 8th legion but viewing it through a style i had created for blackgamer.net?
It's not a redirect. My site is an example of one with parked domains:

http://www.mscclan.com/forum/
http://www.macsubculture.com/forum/
http://www.mac-gamer.com/forum/

Notice how each domain points to exactly the same content.
 

DRE

Well-known member
#11
Maybe. I don't care about my page rank.

This also works with subdomains. Though that would also qualify as duplicate content.
Okay I just had idea. My site, The8thLegion has almost a hundred thousand posts compared to my other site BlackGamer which only has a hundred or so.

If I make BlackGamer a parked domain for The 8th Legion, any thread that is from the8thlegion would show up under blackgamer's domain. What if I blocked whole forums and sections of BlackGamer from the search engine using robots.txt file or something like that. But let The 8th Legion open as normal. Would that work in preventing duplicate content?
 

Jake Bunce

XenForo moderator
Staff member
#12
Okay I just had idea. My site, The8thLegion has almost a hundred thousand posts compared to my other site BlackGamer which only has a hundred or so.

If I make BlackGamer a parked domain for The 8th Legion, any thread that is from the8thlegion would show up under blackgamer's domain. What if I blocked whole forums and sections of BlackGamer from the search engine using robots.txt file or something like that. But let The 8th Legion open as normal. Would that work in preventing duplicate content?
I can't think of a way to make that work using robots.txt.
 

DRE

Well-known member
#13
I can't think of a way to make that work using robots.txt.
http://www.dotservant.com/knowledgebase/domain/whatisparkdomain.shtml

Parked domain and search engines

Parking domain is a handy solution, but if you are concern about Search engines traffic, you should be aware that search engines do not like to see same piece of content being serve more than one time, with a park domain setup, you are serving identical set of website and web pages, search engines will consider this content as duplicate content and this is going to affect your search engine rankings, you should have a good robots.txt instruction to block search engine crawlers on parked domains, and only allow indexing on the main domain. This will prevent the duplicate content issue in search engines and yet still able to use the parked domain feature.
 

0xym0r0n

Well-known member
#15
Would that work in preventing duplicate content?
Do permanent redirect to 8thlegion by doing this you are crediting 8thlegion with the content and google will not penalize you for this.

Otherwise you more than likely will loose rank on 8thlegion. Blackgamer will not gain any rank and will probably loose any rank it has.

*note please do research before doing anything i recommend. I merely read around a lot and this is what i remember. I'm not responsible for rank loss or other damage!*

:)
 

DRE

Well-known member
#16
Do permanent redirect to 8thlegion by doing this you are crediting 8thlegion with the content and google will not penalize you for this.

Otherwise you more than likely will loose rank on 8thlegion. Blackgamer will not gain any rank and will probably loose any rank it has.

*note please do research before doing anything i recommend. I merely read around a lot and this is what i remember. I'm not responsible for rank loss or other damage!*

:)
Thanks but Google terminated my Google Adsense account for the8thlegion domain and email so I moved the whole site over to my blackgamer domain so that I can get another adsense account in my someone else's name. smh
 

0xym0r0n

Well-known member
#17
Thanks but Google terminated my Google Adsense account for the8thlegion domain and email so I moved the whole site over to my blackgamer domain so that I can get another adsense account in my someone else's name. smh
Yeah the same happened to me a long time ago. I followed the rules but my account was terminated due to fraudulent clicks. I NEVER clicked any of my own ads. So I spoke to them and they said I probably had a visitor who kept clicking my ads... i'm like wtf?! seriously, so can I have my account back and remove those invalid clicks??? Answer - No, because you violated the rules.

I can't help that I had a visitor who was a little click happy. I really can't. It was an information site too, wasn't even a dang forum where I know my members personally. SO! I said screw 'em.

Totally OT but I felt like ranting.
 
#19
Oh this is cool, was about to install an add-on to detect mobile devices but I think I'll use this method!
That way people can choose to view the full site if they wish, thanks for this!
 

0xym0r0n

Well-known member
#20
This worked like it said but the issue is my users are unable to switch styles afterwards.

It either kept them on my default style for my main domain or on the alternate style for my other domain. There was only 2 styles depending on the domain you used. They were unable to switch afterwards.

Not a bug but I'm stating this for anyone who has a question about varied style options of users.