Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • umbracocool 108 posts 197 karma points
    Jan 31, 2012 @ 21:59
    umbracocool
    0

    How to change the friendly url, the extension ". aspx" and change it. ".html" or other extension?

     

    Greetings!, In advance thanks to the Umbraco CMS community..

    I tried changing the extension ".aspx" for. ".html", but do not know how.

    I have changed:

    <add key="umbracoUseDirectoryUrls" value="true" />

    and works very well, but I would like to know if you can put as ".html".

    Thank you!

     

     

  • Rodion Novoselov 694 posts 859 karma points
    Feb 01, 2012 @ 02:40
    Rodion Novoselov
    0

    Hi. I would do it with URL rewriting.

  • umbracocool 108 posts 197 karma points
    Feb 01, 2012 @ 03:20
    umbracocool
    0

    Thank you very much!. I tried to modify the UrlRewriting.config file, but this does not work, and the part that should change is:

    That's the change I want to get

    Thank you very much!

  • Rodion Novoselov 694 posts 859 karma points
    Feb 01, 2012 @ 04:06
    Rodion Novoselov
    0

    I have hardly any expertise in UrlRewriting.NET that's shipped with Umbraco since I prefer IIS Url Rewriting module.

    For IIS Url Rewriting module the configuration might look like this:

     

            <rewrite>
                <rules>
                    <rule name="ASPX to HTML">
                        <match url="(.*)\.html" />
                        <action type="Rewrite" url="{r:1}.aspx" />
                    </rule>
                </rules>
                <outboundRules>
                    <rule name="HTML to ASPX">
                        <match filterByTags="A" pattern="(.*)\.aspx" />
                        <action type="Rewrite" value="{r:1}.html" />
                    </rule>
                </outboundRules>
            </rewrite>

     

  • umbracocool 108 posts 197 karma points
    Feb 01, 2012 @ 04:41
    umbracocool
    0

    Thank you!. I placed the code I put in the file "/config/UrlRewriting.config" but I did not work and has launched a mistake, I'm using Umbraco version 4.7.1. Any other ideas?

  • Rodion Novoselov 694 posts 859 karma points
    Feb 01, 2012 @ 05:16
    Rodion Novoselov
    0

    Nope. The ~/config/Urlrewriting.config is for UrlRewriting.Net. The snippet I gave is for the IIS URL rewriting module. You need to install it if it's not installed already. The download link: http://www.iis.net/download/urlrewrite. And than put that <rewrite> section under  the <system.webServer> one. Also after installing the URL Rewrite module you can use IIS manager to maintain the rules with GUI.

  • umbracocool 108 posts 197 karma points
    Feb 01, 2012 @ 06:32
    umbracocool
    0

    Thank you!. I installed UrlRewriting in IIS 7, Also do I have added a rule:

    Where do I put this code?  <rewrite>

                <rules>
                   
    <rulename="ASPX to HTML">
                       
    <matchurl="(.*)\.html"/>
                       
    <actiontype="Rewrite"url="{r:1}.aspx"/>
                   
    </rule>
               
    </rules>
               
    <outboundRules>
                   
    <rulename="HTML to ASPX">
                       
    <matchfilterByTags="A"pattern="(.*)\.aspx"/>
                       
    <actiontype="Rewrite"value="{r:1}.html"/>
                   
    </rule>
               
    </outboundRules>
           
    </rewrite>

     

     

  • Rodion Novoselov 694 posts 859 karma points
    Feb 01, 2012 @ 07:21
    Rodion Novoselov
    0

    This code is the configuration for the Url Rewrite IIS module and should go into web.config (to inside <system.webServer> section). If everything after that is ok you will see this couple of rules (one inbound and one outbound) when you open the "Url Rewriting" settings in the IIS Manager (this setting editor window is in fact just GUI to this config section). You can also try just to add this rules from the GUI istead of putting them down into the web.config file manually.

  • umbracocool 108 posts 197 karma points
    Feb 01, 2012 @ 16:53
    umbracocool
    0

    Thank you for helping me!. I think it will not be long for this to work, look at the pictures:

    I feel I lack little to solve my problem. To what may be this error?

  • Rodion Novoselov 694 posts 859 karma points
    Feb 01, 2012 @ 17:17
    Rodion Novoselov
    0

    Woops. "rulename" -> "rule name" (with a space :-)

  • umbracocool 108 posts 197 karma points
    Feb 01, 2012 @ 17:19
    umbracocool
    0

    I'm sorry, the last error was showing syntax, see the pictures:

    I feel I lack little to solve this problem. Thank you very much!

  • Rodion Novoselov 694 posts 859 karma points
    Feb 01, 2012 @ 17:29
    Rodion Novoselov
    0

    Here's exactly how I've configured in my config:

            <rewrite>
                <rules>
                    <rule name="Html to Aspx">
                        <match url="(.*)\.html" />
                        <action type="Rewrite" url="{R:1}.aspx" />
                    </rule>
                </rules>
                <outboundRules>
                    <rule name="Aspx to Html">
                        <match filterByTags="A" pattern="(.*)\.aspx" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
                        <action type="Rewrite" value="{R:1}.html" />
                    </rule>
                </outboundRules>
            </rewrite>
    Everything seems to work OK by now.
    Have you removed your old configuration (~/config/UrlRewriting.config)? You should've done this since the UrlRewriting.NET module is turned on by default as well.
Please Sign in or register to post replies

Write your reply to:

Draft