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

However, the actual domain is in which 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 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 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/';
$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 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] [client] Request exceeded the limit of 10 internal redirects due to probable configuration error.
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 ^(.*)$$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:
Thanks. That rewriterule still gives the redirect error and forces everything to ... I checked the /.htaccess and there aren't any other redirects.
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 ^(.*)$$1 [R=301,L]

Does something like this seem plausible?

    RewriteCond %{HTTP_HOST} ^community\$
    ReWriteBase /
    RewriteCond %{HTTP_HOST} !^community\.tuxreportsnetwork\.com$
    ReWriteBase /community
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 :)
Top Bottom