I enabled directory URLs. After doing so, pages I created throw a 404 if the trailing slash is included in URL.
mydomain.com/contact will not throw an error mydomain.com/contact/ will throw an error
I edited umbracoSettings.config and set addTrailingSlash to false which helps newly published pages from automatically including the slash.
However, if the slash is added in the URL the page will fail. It is my understanding that the page should be displayed correctly with or without the trailing slash. Am I wrong in thinking that? I have concerns that other sites linking in will include the trailing slash and will receive 404s.
Is there a way I can configure Umbraco to display the page regardless of the trailing slash being added or not?
I have a problem with trailing slashes and directory URLS.
Actually both are set to True in their config files. I assume that when someone tries to reach to a page say http://domain.com/page ; should redirect to the URL with trailing slash like http://domain.com/page/
Trailing Slash & Directory URLS
I enabled directory URLs. After doing so, pages I created throw a 404 if the trailing slash is included in URL.
mydomain.com/contact will not throw an error
mydomain.com/contact/ will throw an error
I edited umbracoSettings.config and set addTrailingSlash to false which helps newly published pages from automatically including the slash.
However, if the slash is added in the URL the page will fail. It is my understanding that the page should be displayed correctly with or without the trailing slash. Am I wrong in thinking that? I have concerns that other sites linking in will include the trailing slash and will receive 404s.
Is there a way I can configure Umbraco to display the page regardless of the trailing slash being added or not?
What kind of 404 do you get, the one thrown by umbraco or the one thrown by IIS?
My guess is that you get the one from IIS, which means that IIS handles the directory-calls instead of letting umbraco handle that.
Do you have wildcard-mapping set up in IIS?
Peter
The 404 is from Umbraco, not IIS.
I have a problem with trailing slashes and directory URLS.
Actually both are set to True in their config files. I assume that when someone tries to reach to a page say http://domain.com/page ; should redirect to the URL with trailing slash like http://domain.com/page/
Is this possible or am i thinking wrong?
Thanks
Muhammad
Hey,
You can do that with rewrites
<rule name="Add trailing slash" stopProcessing="true">
<match url="(.*[^/])$" ignoreCase="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/umbraco/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/([0-9]+).aspx" negate="true" />
<add input="{URL}" pattern="^.*\.(asp|aspx|axd|asmx|css|js|jpg|jpeg|png|gif|mp3)$" negate="true" ignoreCase="true" />
<add input="{URL}" pattern="/Base" negate="true" />
<add input="{URL}" pattern="cdv=1" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}/" />
</rule>
From here http://umbraco.miketaylor.eu/2010/11/03/url-rewriting-and-seo/
Rich
It really helped. Thanks Rich
is working on a reply...