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

Subdomain Installation


Well-known member
My XF installation has been running fine for over a year. Today, I realized that my approach is completely wrong for SEO and for simple organization of subnetworks (WP).

Currently the board URL in the admin panel is set to http://www.technologyquestions.com/community

However, the actual domain is www.tuxreportsnetwork.com in which technologyquestions.com is a mapped domain through WP. Everything is accessible. But it is also accessible from any of the domains that are mapped. While restructuring the menus on the WP side, I realized the appropriate way to reach the community is http://community.tuxreportsnetwork.com and nothing else should be getting to it.

The frontpage loads but if I click on a link then there is an 500 internal server error.

How do I set this installation up so that community.tuxreportsnetwork.com works?

This is the current config.php (minus host, port, passwords, etc).

$config['cache']['enabled'] = true;
$config['cache']['cacheSessions'] = true;
$config['cache']['backend'] = 'File';
$config['cache']['backendOptions'] ['cache_dir'] = '/pathto/tuxreportsnetwork.com/community/internal_data/cache';
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
$config['cache']['backend'] = 'File';
$config['adminLogLength'] = 30;
$config['superAdmins'] = 'xx';
Note: Because of the XenScript add-on, all users must log in through XF. This also means login for each of the WP domains. This restriction means I cannot forward everything to community subdomain. Does that make sense? So, the solution must be something to get community.tuxreportsnetwork.com to work and I can hard code menus to always point to that domain. Maybe then block search engines from crawling via the other domains. Correct?

Update: I looked in the error logs for the server.

[host community.tabletquestions.com] [client xxx.xx.xxx.xxx] Request exceeded the limit of 10 internal redirects due to probable configuration error.

Jake Bunce

XenForo moderator
Staff member
Given the "internal redirects" error, the 500 ISE error might be a problem with your .htaccess file(s). Try temporarily removing any .htaccess files to see if that fixes it.

You can use a RewriteRule in your .htaccess to enforce the subdomain. Add this to the .htaccess file in your /community directory:

Rich (BB code):
#	Mod_security can interfere with uploading of content such as attachments. If you
#	cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#	SecFilterEngine Off
#	SecFilterScanPOST Off

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
	RewriteEngine On

	RewriteCond %{HTTP_HOST} !^community\.tuxreportsnetwork\.com$
	RewriteRule ^(.*)$ http://community.tuxreportsnetwork.com/$1 [R=301,L]

	#	If you are having problems with the rewrite rules, remove the "#" from the
	#	line that begins "RewriteBase" below. You will also have to change the path
	#	of the rewrite to reflect the path to your XenForo installation.
	#RewriteBase /xenforo

	#	This line may be needed to enable WebDAV editing with PHP as a CGI.
	#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -l [OR]
	RewriteCond %{REQUEST_FILENAME} -d
	RewriteRule ^.*$ - [NC,L]
	RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
	RewriteRule ^.*$ index.php [NC,L]
You may wish to adjust your cookie scope for the subdomain depending on your setup:



Well-known member
Thanks. That rewriterule still gives the redirect error and forces everything to community.tuxreportsnetwork.com ... I checked the /.htaccess and there aren't any other redirects.


Well-known member
OK. I'm back to this topic .. because there are some redirect issues on a particular subdomain. After doing a little reading .. directives may help to give a type of "if/then" logic (I know this isn't possible) except to say ...

If subdomain = community
then rewritebase /

All other directives ...

This not statement given by Jake is the key .. I hope ..

RewriteCond %{HTTP_HOST} !^community\.tuxreportsnetwork\.com$
RewriteRule ^(.*)$ http://community.tuxreportsnetwork.com/$1 [R=301,L]

Does something like this seem plausible?

    RewriteCond %{HTTP_HOST} ^community\.tuxreportsnetwork.com$
    ReWriteBase /
    RewriteCond %{HTTP_HOST} !^community\.tuxreportsnetwork\.com$
    ReWriteBase /community


Well-known member
Thank you. The spring blog posting states this is new to Apache 2.4. The server with XF installation is Apache 2.2.

Some day :)