Apologies for creating 3 issues in one day.

What are the SEO complications for having these subdomains? As they are full subdomains (rather than point directly to the relevant folders, like /files/ etc), they are accessible by google etal. Our content would be seen as being duplicated over the three extra subdomains.

Am I right or is there someway of disallowing those domains being crawled?

Thanks,
Paul.

Comments

mikeytown2’s picture

See
#579624: Redirect non image/css/js requests from cdn1.example.com to example.com or www.example.com

Also be aware that for some reason javascript doesn't work correctly with this, so .js files get 301-ed for some reason. I don't use js parallelization on my site since I only have 1 file to download anyway.

techypaul’s picture

Hi,

Thats exactly what I was looking for - I spent ages on google looking for the right wording to make it happen. Thanks for your advice, I'll attempt to make the changes! By leaving the JS field empty it won't get parallelised? Suits me anyway with JS Query prob.

Thanks,
Paul.

mikeytown2’s picture

I don't think you could have found those rewrite rules on Google; came up with them my self, just for this project.

Yes leave it blank and it does not get "paralleled".

Lazarevac’s picture

Do you suggest it would work for add-on domains too? We had few issues with add-on domains where Google reported double content for addondomain.example.com and addondomain.com since these contents were actually equal...

mikeytown2’s picture

@Lazarevac
Your situation is different and not related this, the parallel module.

chadd’s picture

when i add the .htaccess rules you linked to in #1, yslow downgrades me in the "avoid URL redirects" category.
is that something that I should be concerned with? Personally, I didn't notice any performance changes one way or the other...

mikeytown2’s picture

Are you using the ones from http://drupal.org/node/579624#comment-2120792?

if your getting that from yslow it means your getting nothing, as in parallel isn't doing anything then; its redirecting back to your domain from the subdomains.
What does the network tab say in firebug?

chadd’s picture

i was using the rules from the OP, not that comment.
rules from the comment worked. thanks.

mikeytown2’s picture

Status: Active » Needs review

Place this above boost rules if you have any; otherwise this goes below # RewriteBase / in your htaccess file.

  #Parallel Redirect
  RewriteCond %{REQUEST_URI} !(^/(.*)(.js|.css)) [NC]
  RewriteCond %{HTTP_ACCEPT} !(.*image.*|.*css.*|.*javascript.*) [NC]
  RewriteCond %{HTTP_HOST} ^(cdn1.example.com|cdn2.example.com|cdn3.example.com)$ [NC]
  RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

This will redirect all non image/javascript/css requests back to www.example.com via 301 redirect. Be sure to replace example.com with your own site name; also remove the www. if you don't want that.

Another example using drupal.org

  #Parallel Redirect
  RewriteCond %{REQUEST_URI} !(^/(.*)(.js|.css)) [NC]
  RewriteCond %{HTTP_ACCEPT} !(.*image.*|.*css.*|.*javascript.*) [NC]
  RewriteCond %{HTTP_HOST} ^(cdn1.drupal.org|cdn2.drupal.org|cdn3.drupal.org)$ [NC]
  RewriteRule ^(.*)$ http://drupal.org/$1 [L,R=301]
heyyo’s picture

Not sure if it's related but on my images are not indexed on my website where I use modules parallel. I checked my robots.txt and path to images is not blocked.

my webite: seasecret .biz

mikeytown2’s picture

@heyyo
I think it has to do with your images being inside a .swf file

vkr11’s picture

Susbscribe

heyyo’s picture

@mikeytown2
Forget my issue my images are now indexed.

mikeytown2’s picture

#352180: Better, multi-site friendly "www." addition/removal in .htaccess Need to track this so this htaccess trick will work with multisite's easily.

shopdogg’s picture

subscribe

Rosamunda’s picture

subscribe.

Wim Leers’s picture

Status: Needs review » Closed (won't fix)
stevethewebguy’s picture

I use this to make sure the sub dose not serve anything but the kind of content it's suppose to (also ensures no canonical issue from the requesting, www, domain):

RewriteCond %{HTTP_HOST} static.plattdaddy.com [NC]
 RewriteCond %{REQUEST_URI} !\.(png|gif|jpg|jpeg|js|css|swf)$ [NC]
 RewriteRule ^(.*)$ http://www.plattdaddy.com/$1 [L,R=301]

 RewriteCond %{HTTP_HOST} www.plattdaddy.com [NC]
 RewriteCond %{REQUEST_URI} \.(png|gif|jpg|jpeg|js|css|swf)$ [NC]
 RewriteRule ^(.*)$ http://static.plattdaddy.com/$1 [L,R=301]

I only use one "static" "cdn" domain, if you're using multiple, you'll need to make a copy of both for as many as you need. Here is an example of redirecting an "img", "static", and "www" domains properly:

 RewriteCond %{HTTP_HOST} static.plattdaddy.com [NC]
 RewriteCond %{REQUEST_URI} !\.(js|css|swf)$ [NC]
 RewriteRule ^(.*)$ http://www.plattdaddy.com/$1 [L,R=301]

 RewriteCond %{HTTP_HOST} www.plattdaddy.com [NC]
 RewriteCond %{REQUEST_URI} \.(js|css|swf)$ [NC]
 RewriteRule ^(.*)$ http://static.plattdaddy.com/$1 [L,R=301]

RewriteCond %{HTTP_HOST} img.plattdaddy.com [NC]
 RewriteCond %{REQUEST_URI} !\.(png|gif|jpg|jpeg)$ [NC]
 RewriteRule ^(.*)$ http://www.plattdaddy.com/$1 [L,R=301]

 RewriteCond %{HTTP_HOST} www.plattdaddy.com [NC]
 RewriteCond %{REQUEST_URI} \.(png|gif|jpg|jpeg)$ [NC]
 RewriteRule ^(.*)$ http://img.plattdaddy.com/$1 [L,R=301]

See what I did there for adding another? Two more rules required, let me know if this is helpful, or someone finds it flawed.

vishalchavda’s picture

Hello

I have a similar set up as yours with 1 sub-domain that is created via CNAME.
so to simplify i have
http://example.com ==> main site
cdn1.example.com ==> CNAME - created for CDN to deliver images only

The cdn1 folder is empty i.e. no files stored. ==> Is this Ok or do i need to copy the folder structure from my main site ?
I have set up the CDN module to serve .image files from the cdn1 location.

I tested your rewrite rules but I cant get them to work. i.e. links from the cdn1 are not redirected to the main site's image folder.

regards