I'm trying on my own to create a robots.txt based on a document type with template. If I go to "http://mysite.com/settings/robots-txt" it works. If I go to the URL Alias "http://mysite.com/robots.txt" I get a 404 not found.
I'm not sure if it's my URL rewrite rule or if it's a conflict with the umbracoUrlAlias. Any assistance is appreciated. Below is my current implementation.
I added a URL rewrite rule to remove the trailing slash and the umbracoSettings.config requestHandler "addTrailingSlash>false</addTrailingSlash>"
The document type has one property editor: umbracoUrlAlias with default value of robots.txt
Here's the template:
@inherits Umbraco.Web.Mvc.UmbracoViewPage<ContentModels.RobotsTxt>
@using ContentModels = Umbraco.Web.PublishedModels;
@{
Layout = null;
Response.ContentType = "text/plain";
var siteMap = Model.AncestorOrSelf<HomePage>().FirstChild<SiteSettings>().FirstChild<XmlSiteMap>();
}
/* my robots.txt text goes here */
multisite robots.txt
I'm trying on my own to create a robots.txt based on a document type with template. If I go to
"http://mysite.com/settings/robots-txt"
it works. If I go to the URL Alias"http://mysite.com/robots.txt"
I get a 404 not found.I'm not sure if it's my URL rewrite rule or if it's a conflict with the umbracoUrlAlias. Any assistance is appreciated. Below is my current implementation.
I added a URL rewrite rule to remove the trailing slash and the umbracoSettings.config requestHandler
"addTrailingSlash>false</addTrailingSlash>"
The document type has one property editor:
umbracoUrlAlias
with default value ofrobots.txt
Here's the template:
URL Rewrite Rule:
Published URLs:
I think it should be more simple
Needed to make it
/settings/robots-txt
And that seems to make it work.
did u find using this approach that google search console could read your robots?
is working on a reply...