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

.htaccess on multisite WP

LPH

Well-known member
#1
Hi,

I think there is a big issue with my installation. I have WP 3.3.1 installed, multisite enabled, and XF in /community directory.

I only want the forums available using www.tuxreportsdebates.com/community

However, someone can use www.tuxreportsnetwork.com/community or any other domain on the multisite install to get to the forums.

What is the best way to get it so that only www.tuxreportsdebates.com/community is seen by the search engines and more important - by the visitor ?!

Update: I should be more proactive and explain that a few .htaccess attempts do not seem to be working.

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

LPH

Well-known member
#2
Well - the host tried this one and it didn't work either

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

Jake Bunce

XenForo moderator
Staff member
#3
Add the red code to the .htaccess file in the 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} !^www\.tuxreportsdebates\.com$
	RewriteRule ^(.*)$ http://www.tuxreportsdebates.com/community/$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>
That should work.
 

LPH

Well-known member
#4
Thank you. Yes. It turns out the rewrite rules had to go into /community. Unfortunately, if this rewrite is done then I cannot use the XenScript bridge. After fussing several days, it looks like I'll keep looking for better navigation.