+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Sitefinity 4.2 and using .html page extension

Sitefinity 4.2 and using .html page extension

9 posts, 0 answered
  1. Jeff Mah
    Jeff Mah avatar
    31 posts
    Registered:
    25 Feb 2005
    09 Sep 2011
    Link to this post
    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?
  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    09 Sep 2011
    Link to this post
    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

  3. Jeff Mah
    Jeff Mah avatar
    31 posts
    Registered:
    25 Feb 2005
    12 Sep 2011
    Link to this post
    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.
  4. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    12 Sep 2011
    Link to this post
    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?
  5. Jeff Mah
    Jeff Mah avatar
    31 posts
    Registered:
    25 Feb 2005
    13 Sep 2011
    Link to this post
    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.
  6. Josh
    Josh avatar
    2 posts
    Registered:
    26 Apr 2011
    29 Sep 2011
    Link to this post
    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
  7. Josh
    Josh avatar
    2 posts
    Registered:
    26 Apr 2011
    29 Sep 2011
    Link to this post
    It looks like sitefinity can take of this at the IIS level by a simple change in the web.config

    http://www.sitefinity.com/documentation/installation-and-administration-guide/running-a-project/creating-and-running-projects-on-iis/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>

    This is a very small modification of the sample from that link. (RemoveTrailingSlash -> RemoveTrailingHtml)

    UPDATE:
    Since I edited this post, I have fixed a regex bug and now the code above works perfectly.
    I tested this on two machines with Windows 7 64 bit and IIS 7.5.
    Please be sure to have 'Url Rewrite 2.0' installed on IIS for this to work properly.
    Without this installed, your site will have a web.config error as the rewrite tag will not be supported.

    Also noteworthy, there really are two rules here, the first additionally lowercases all requests.
    The lowercase rule of course is optional.

    Regards,
    Josh
  8. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    30 Sep 2011
    Link to this post
    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.

    All the best,
    Svetoslav Petsov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    15 Aug 2012
    Link to this post
    multiple ULR work in 5.1 so you can use

    ~/oldpage
    ~/oldpage.aspx
    ~/oldpage.html
    ~/oldpage.susi

    Markus
9 posts, 0 answered