Copied to clipboard

Flag this post as spam?

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


  • Shada 55 posts 137 karma points
    May 13, 2015 @ 11:10
    Shada
    0

    export htaccess into umbraco project

    I'm migrating my php project in the umbraco mvc project. In the new project I am using UrlRewriter:

    <section name="urlrewritingnet" restartOnExternalChanges="true" requirePermission="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter" />
    

    In a php project I still have a htaccess file with the rewrite. I'd like to transfer htaccess in my new project so that rules out it was done before the rules of UrlRewriter.

    When I tried to convert htaccess rules to iis and add to web.config section rewrites I received an error: HTTP error 500.19 - Internal Server Error The requested page cannot be accessed because of incorrect configuration data for the page.

    <system.webServer>
    <rewrite>
       <rules>
      <rule name="rule 1b" stopProcessing="true">
        <match url="^(.*)"  />
        <action type="Rewrite" url="http://someUrl/{R:1}"  />
    </rule>
    </rewrite>
    

    Thanks

  • Shada 55 posts 137 karma points
    May 13, 2015 @ 15:19
    Shada
    0

    After I installed IIS URL Rewrite 2.0, the error 500.19 is gone. But if I add a rule in the web.config it doesn't work.

    <rewrite>  
     <rules>
      <rule name="rule 1b" stopProcessing="true">
       <match url="(.*)" />
       <action type="Rewrite" url="http://localhost/ru/{R:1}" />
      </rule>
     </rules>
    </rewrite>
    
  • nehakakar 14 posts 84 karma points
    Jul 10, 2023 @ 22:21
    nehakakar
    0

    This is how you can translate a simple rewrite rule from an .htaccess file to the web.config format.

    .htaccess rule.

    RewriteRule ^old-page$ /new-page [R=301,L]
    

    Equivalent web.config rule.

    <rule name="Redirect old-page to new-page" stopProcessing="true">
      <match url="^old-page$" />
      <action type="Redirect" url="/new-page" redirectType="Permanent" />
    </rule>
    

    You can add multiple rewrite rules inside the

    it usually indicates a problem with the web.config file syntax or configuration. Double-check the syntax of the rules you added, and ensure they are placed in the correct section of the web.config file.

Please Sign in or register to post replies

Write your reply to:

Draft