XF 1.2 Duplicate content

Fred.

Well-known member
Hi,

I have my site on domain.com and i'm serving my images and JS from a static domain img.otherdomain.com and js.otherdomain.com. The otherdomain.com points to the same data directory on my server.

Today i've noticed that google is indexing my forum from otherdomain.com and that my forum is available from otherdomain.com :eek:

I've had vBulletin + vBSEO installed before and never had a problem with this.

How can i block this so they can't access the forum from otherdomain.com?

Rewrite rules?
Can anyone give me some examples? I don't know exactly how to fix this.

Thanks :-)
 
We can use rewrite rules if you can identify the types of URLs that you want to allow on otherdomain.com. For example, if all images / js are contained in specific directories then you can use rewrites to white list those directories and redirect everything else. I just need example URLs from you.
 
Hi Jake,

I have data.otherdomain.com for images.
Example url :
Code:
http://data.otherdomain.com/data/avatars/m/0/3.jpg?1389192243

js.otherdomain.com for javascript.
Example url :
Code:
http://js.otherdomain.com/js/xenforo/xenforo.js?_v=1a58a291

and att.otherdomain.com for attachments.
Example url :
Code:
http://att.otherdomain.com/2014/02/515_43ae13d9c5e2c0b943c7a167ffaf0622.jpg?Expires=1391785869&Signature=Pp1vsjhn9oror0EMQ-rHv-u0JUDupSkSxpkc7CHAGk7y6tLLpQ8be4QrQfPQZCQfDBfXldCbI144Ng367N4MhzBj7IC2P5qFPNdvEsHw3t1~YAunz4f9ZCbsFGnoEv0HdFymCTF0XbJ4eUTiR0654Ggkye1Xi9Gvi5w7HbrsJX75GdEC6iLxck38XOaFyCKy4YnGES3hT0QKdzha8bRJrNsf94RmCw99FrbW0XE1knpQ61giGkGY2oF9Cg5fEMs46Z1kcZDxLdKH3S6GsxGjokpHcTY0dn2vkdSPO-vBDweFzODpjhyNkvTRnAfWQVpw0qaNydGBNC2xc1mGzEqF2Q__&Key-Pair-Id=APKAIAAQJBX2CX45RHEQ

I use a CDN for all of these (My CDN provider Pull's the static content from my server)

In the near future I want to switch to full SSL so it must be available over SSL too.
All other url's can redirect to domain.com

Thanks :-)
 
Put at the top of the .htaccess file in your web root:

Code:
RewriteEngine On

RewriteCond %{HTTP_HOST} ^data\.otherdomain\.com$
RewriteRule ^data/ - [S=1]
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^js\.otherdomain\.com$
RewriteRule ^js/ - [S=1]
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^att\.otherdomain\.com$
RewriteRule ^[0-9]{4}/ - [S=1]
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [R=301,L]

That should do it.
 
Hi Jake,

It's in conflict with my other rewrite rules. (redirection loop)

Code:
RewriteEngine on

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

RewriteRule f[\d]+/.+-([\d]+)/index([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
RewriteRule f[\d]+/.+-([\d]+)/ showthread.php?t=$1 [NC,L]
RewriteRule f([\d]+)/index([\d]+).html forumdisplay.php?f=$1&page=$2 [NC,L]
RewriteRule f([\d]+)/ forumdisplay.php?f=$1 [NC,L]

I just tried it on 1 of my sites, i'll try it on the other one tonight. But it's probably going to be the same.
 
Nah that's my dumb.

Try this:

Code:
RewriteEngine On

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

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

RewriteCond %{HTTP_HOST} ^att\.otherdomain\.com$
RewriteRule !^([0-9]{4}/.*)$ http://www.maindomain.com/$1 [R=301,L]
 
Great! Thanks :-)
That works perfect :D

One more question.
When I go to data.otherdomain.com it shows my forum index, all the forum links are pointing to the main domain. But the index is still duplicate content. Do you think there is a solution for this? Is it bad? Or should i leave it like that?
 
Top Bottom