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

Subdomain Installation

LPH

Well-known member
#1
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).

Code:
$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.


Code:
[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
#2
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:

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
#</IfModule>

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]
</IfModule>
You may wish to adjust your cookie scope for the subdomain depending on your setup:

http://xenforo.com/community/threads/xenforos-handing-of-cookie-domains.15260/#post-200173
 

LPH

Well-known member
#3
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.
 

LPH

Well-known member
#5
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 /
else
(blank)

All other directives ...

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

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

Does something like this seem plausible?

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

LPH

Well-known member
#7
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 :)