Sitefinity 4.2 and using .html page extension
Hello,
I have a page (i.e. /about-us/careers) that I need to come up when I have a .html page extension (i.e. /about-us/careers.html) but all I am getting is a 404. For the page I have the "~/about-us/careers.html" set as an entry under "Allow multiple URLs..." in Title & Properties. I also tried adding the extension in IIS so .html is handled by the .NET 4 aspnet_isapi.dll. It doesn't work with the handler set or not set. Am I missing something?
Hmmm, what's the use case? Is it an upgrade of an old site and they don't want to lose old links?
IMO /about-us/careers seems way better than /about-us/careers.html
It's a migration of an old site and I, as well, prefer the non-html link but I need the .html link to work in order to support some script that i'm told cannot change. It should be simple to add but it just doesn't work. Before upgrading to Sitefinity 4.2 all I had to do to get the .html extension working was to change the "URL" for the page and everything worked fine. Now, after the upgrade, this does not work and I just get the 404. Any thoughts would be great.
Have you tried setting an "alternate URL" in the page properties?
Would that work?...then no more dead links and the Goog will get updated?
That's the problem, I've added alternate URLs into this list but all I get is 404 errors when I go to those links.
I am having exactly the same issue. The alternate .html urls do not work for me either.
And we have exactly the same situation with needing pages to have a .html extension.
I would prefer not to have to resort to a url rewriting solution...
Anyone know if this is a bug or a feature?
Josh
It looks like sitefinity can take of this at the IIS level by a simple change in the web.config
www.sitefinity.com/.../using-url-rewrite-for-seo.aspx
We do need SEO-friendly-everything so I may pursue this avenue.
In the system.webServer tag after the handlers section in the web.config,
I would just need to do something like:
<
rewrite
>
<
rules
>
<
clear
/>
<
rule
name
=
"LowerCaseRule1"
stopProcessing
=
"true"
>
<
match
url
=
"^(Sitefinity/)"
ignoreCase
=
"true"
negate
=
"true"
/>
<
conditions
logicalGrouping
=
"MatchAll"
trackAllCaptures
=
"false"
>
<
add
input
=
"URL"
pattern
=
"[A-Z]"
ignoreCase
=
"false"
/>
<
add
input
=
"URL"
pattern
=
"\.axd"
negate
=
"true"
/>
<
add
input
=
"URL"
pattern
=
"\.xamlx"
negate
=
"true"
/>
<
add
input
=
"URL"
pattern
=
"\.ashx"
negate
=
"true"
/>
<
add
input
=
"URL"
pattern
=
"\.asmx"
negate
=
"true"
/>
<
add
input
=
"URL"
pattern
=
"\.xap"
negate
=
"true"
/>
</
conditions
>
<
action
type
=
"Redirect"
url
=
"ToLower:URL"
redirectType
=
"Permanent"
/>
</
rule
>
<
rule
name
=
"RemoveTrailingHtmlRule1"
stopProcessing
=
"true"
>
<
match
url
=
"(.*)\.html$"
/>
<
conditions
logicalGrouping
=
"MatchAll"
trackAllCaptures
=
"false"
>
<
add
input
=
"REQUEST_FILENAME"
matchType
=
"IsDirectory"
negate
=
"true"
/>
<
add
input
=
"REQUEST_FILENAME"
matchType
=
"IsFile"
negate
=
"true"
/>
</
conditions
>
<
action
type
=
"Redirect"
url
=
"R:1"
/>
</
rule
>
</
rules
>
</
rewrite
>
Hello Josh,
Taking care of this at IIS level is the best option (either with a URL rewriter or the way you suggested).
The extensions which are not allowed for a page url (and if you type such an extension, a 404 error will always be thrown) can be found at Administration >> Advanced >> Pages >> NotAllowedPageExtensions. Before 4.2 SP1, the .htm and .html extensions were also in that list and you could delete them, so after deleting them you could freely use them in your page url and the request would be handled. However, we experienced some issues with this behaviour and decided to make them permanently NotAllowed. There is a way for the extensions to be added to the page url through code, but that is highly not recommended, which again means that using IIS to do that is your best choice.
multiple ULR work in 5.1 so you can use