Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How to get domain specific robots.txt files on DotNetNukeHow to get domain specific robots.txt files on DotNetNuke
Previous
 
Next
New Post
2/17/2012 1:51 PM
 

(Cross post from my Google+ profile)

If you haven't yet, install http://www.iis.net/download/URLRewrite. If you don't have access to the server, ask your host to install.  (Honestly, it should be a default on all Windows Servers.)

Once installed, add the following to the <system.webServer> section of the web.config file...

<rewrite>
<rules>
 <rule name="robots">
<!-- Matches the requests for /robots.txt -->
   <match url="^robots\.txt" />
   <conditions>
<!-- Matches all domains. -->
    <add input="{HTTP_HOST}" pattern="(.*)" />
   </conditions>
<!-- Rewrites to the domain specific file. -->
   <action type="Rewrite" url="robots.{C:0}.txt" appendQueryString="false" />
  </rule>
 </rules>
</rewrite>

The rewrite engine looks for requests to the /robot.txt then grabs the domain from the condition to change the request to the pattern: robots.www.mydomain.com.txt

I chose this pattern as it groups the files together in the file browser.  As this is a rewrite rule, the search engine spiders don’t know the different.  As far as they know, they get properly served, individual files for each domain.

If you don’t want to create a file for each portal, then change the condition to:

<add input="{HTTP_HOST}" pattern="^([a-zA-Z0-9]*\.)?(domain1\.org|domain2\.com)" />

Now you can post different files for:
Robots.txt  generic or “not-matched”
Robots.domain1.com.txt
Robots.dev.domain1.com.txt
Robots.www.domain2.org.txt

 
New Post
3/21/2012 7:28 AM
 
the sitemap provider already supports portal specific sitemaps - see http://www.dotnetnuke.com/Resources/Wiki/Page/Sitemap_Providers.aspx

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
3/21/2012 10:52 AM
 
Sorry Cathal, this post is about robots.txt not sitemaps.


Bruce Chapman also posted about this on his blog recently:

http://www.ifinity.com.au/2012/03/21/Different_robots_files_for_different_DotNetNuke_Portals

 
New Post
3/21/2012 12:25 PM
 
Lance, which files do you list domain specific - all dynamic portal pages should be included in Sitemap.aspx or redirect to login, if not publically available. Which case am I missing?

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
3/21/2012 12:57 PM
 

Compliant spiders like Googlebot or Bingbot start indexing a site by going to /robots.txt first.  The file indicates where they can and can't go on the site, if at all.

That means they will only request the sitemap et al after they parse this file and site access is established.

I have an amendment too.  There are a couple ways to do this: 1) a global rule that requires a robots.txt file for every domain or 2) specific domain files and a fallback for others.  In either case, you have to create specific content or rule for each domain.

Global:

  • Match: < add input="{HTTP_HOST}" pattern="(.*)" / > 
  • Will match all domains and always request a special robots file

Specific domains and fallback:

  • Match: < add input="{HTTP_HOST}" pattern="([a-zA-Z0-9]\.)(domain1\.com|domain2\.org)" / >
  • Will only match domain1.com, domain2.com and their sub-domains. The rest will get the normal  /robot.txt

Both write to:

< action type="Rewrite" url="robots.{C:0}.txt" appendQueryString="false" / >

{C:0} will contain the whole string of the condition.

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How to get domain specific robots.txt files on DotNetNukeHow to get domain specific robots.txt files on DotNetNuke


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out