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

Rewrite

15 posts, 0 answered
  1. rck
    rck avatar
    7 posts
    Registered:
    19 Sep 2006
    18 Mar 2010
    Link to this post
    Hi,

    i am trying to use IIS Rewrite Module with a sitefinity project but i am unable to establish it. what i did is

    <rewrite>
                <rules>
                    <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                        <match url="^urundetay/([^/]+)/([^/]+)/?$" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="UrunDetaylari.aspx?spr={R:1}&name={R:2}" appendQueryString="true" />
                    </rule>
                </rules>
            </rewrite>

    when i start the application it gives me error

    Server Error in '/' Application.
    --------------------------------------------------------------------------------
      
    The resource cannot be found. 
    Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 
      
    Requested URL: /UrunDetaylari.aspx

    Actually i have a page named UrunDetaylari.aspx which is prepared from sitefinity management panel. when i write the link manually to the browser like ...../UrunDetaylari.asx it is working but if i use user friendly url it gives the above error.
    Also, after this error i created a physical file named UrunDetaylari.aspx inside the project and test the rewriting
    module and it worked. So, what do i have to do to make it work for sitefinity pages which are not physical.

    technical specifications

    sitefinity 3.5
    windows server 2008 R2
    IIS 7.5

    Thanks in advance
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    19 Mar 2010
    Link to this post
    Hi Rck,

    Is there any specific reason why you are not using our own Sitefinity rewriter? It will definitely work for your scenario. 

    Please take a look in the User Manual on how to enable the Advanced Url Rewriter module. 

    If you are still having problems with the scenario, we will enable the IIS rewriter module for a local project next week and will test it with the current version.

    All the best,
    Georgi
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. rck
    rck avatar
    7 posts
    Registered:
    19 Sep 2006
    22 Mar 2010
    Link to this post
    Hi,

    I have made some research for sitefinity url rewrite and thank you for your suggestion but it seems to me a bit complicated and i could not understand what is the purpose of using sf404.aspx and error pages when using extensionless urls. Can you explain the relation between error pages and url rewriting? Will my application produce an error for each request if i use extensionless url. Sorry for asking too many questions but i am trying to choose the best one :)

    P.S : If there are already explanations or documentations for my questions, can you provide the link .

    Thanks in advance.
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    22 Mar 2010
    Link to this post
    Hello Rck,

    Thank you for the follow up. 

    sf404.aspx approach was used for old web servers like IIS5/6. You are using IIS7.5, and have wildcard mapping by default in Integrated Pipeline mode, so there is nothing that should be added in IIS - the extensionless URLs will be handled just fine. The only thing you will need is to enable the Sitefinity's AdvancedUrlRewriter module and define your rules. By the way, this will be a lot easier than enabling the IIS rewriter module, and I think it's the best option.

    Please give it a try, and let me know if it is not working for you. 

    Best wishes,
    Georgi
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. rck
    rck avatar
    7 posts
    Registered:
    19 Sep 2006
    22 Mar 2010
    Link to this post
    Hi,

    thank you for the fast replies.
     
    i added this line to the webconfig

    <section name="urlrewrites" type="Telerik.Cms.Web.AdvancedUrlRewriter, Telerik.Cms" />

    and this to system.webserver in webconfig

    <add name="Cms" type="Telerik.Cms.Web.CmsHttpModuleUrlRewrite, Telerik.Cms" preCondition="managedHandler" />

    and add the rules. these configurations not worked for me. is there anything that i did wrong?

    thanks.
  6. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    22 Mar 2010
    Link to this post
    Hello rck,

    Just to make sure that the setup is correct:

    1. web.config

    <configuration>
     
        <configSections>
            <sectionGroup name="telerik">
     
                <section name="urlrewrites" type="Telerik.Cms.Web.AdvancedUrlRewriter, Telerik.Cms"/>
            </sectionGroup>
        </configSections>

    2. web.config, replacing the CmsHttpModule with:

    <httpModules>
      <add name="Cms" type="Telerik.Cms.Web.CmsHttpModuleUrlRewrite, Telerik.Cms"/>
    </httpModules>

    3. Adding Url Rewrite rules:

    <configuration>
        <telerik>
          <urlrewrites>
              <!-- Add your rule elements here -->
              <rule>
                <url>[input URL pattern]</url>
                <rewrite>[replaced URL]</rewrite>
              </rule>
             </urlrewrites>

    Is this the setup you are using? What kind of behavior/errors do you get?

    Best wishes,
    Georgi
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. rck
    rck avatar
    7 posts
    Registered:
    19 Sep 2006
    23 Mar 2010
    Link to this post

    hi,

    i did what you said and i am getting

    Server Error 
    404 - File or directory not found. 
    The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

    i added urlrewrites to sections part

    <section name="urlrewrites" type="Telerik.Cms.Web.AdvancedUrlRewriter, Telerik.Cms"/>

    i added  rewritemodule to modules in system.web http modules section

    <httpModules>
      <add name="Cms" type="Telerik.Cms.Web.CmsHttpModuleUrlRewrite, Telerik.Cms"/>
    </httpModules>

    i added the rules

    <rule
    <url>/abc</url
    <rewrite>/cba.aspx</rewrite>
    </rule>

    i could not find where i am doing it wrong.

    P.S : there is also a decleration in the modules part of system.webserver for cmshttpmoduleurlrewrite

    thanks...

  8. rck
    rck avatar
    7 posts
    Registered:
    19 Sep 2006
    23 Mar 2010
    Link to this post
    Hi,

    I think i forgot to say the most important point. 

    With the above configuration if i use the url

    mydomain.../abc

    the application gives the 404 error but in the error explanation  it shows 
    mydomain.../cba.aspx

    as the missing url. So the application is looking for the address what i am expecting exactly, but it can not find the page. The worst thing is "THERE IS A PAGE" with the name cba.aspx and the path is correct.
    On the other hand, if i create a physical file named cba aspx in the required path, it is working. I mean if there is a physical file and if i write

    mydomain.../abc

    it is going to

    mydomain../cba.aspx

    and there is no error.

    As a result , can you explain where i am doing wrong. Only three declerations that you sent are enough for using url rewriting or do i need some extra configuration on sitefinity part or IIS or whatever.

    thanks..

  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    31 Mar 2010
    Link to this post
    Hi rck,

    I tried the to rewrite some urls using very basic rules, actually almost the same you used and I was not able to reproduce this problem

    Here is my rule

    <urlrewrites>
      <!-- Add your rule elements here -->
      <rule>
        <url>abc</url>
        <rewrite>cba.aspx</rewrite>
      </rule>
    </urlrewrites>

    I also attached a sample video that shows the rewriting.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  10. rck
    rck avatar
    7 posts
    Registered:
    19 Sep 2006
    31 Mar 2010
    Link to this post
    hi,
    :)
    i am not able to prepare a video like yours just now, i am sorry, but it is still not working for me .
    thank you for the extensive example but i did exactly what you did. what is your sitefinity version? did you make any configuration changes on IIS or is there any required configuration with the application to set up url rewriting thing?
     
    i still could not find where i am wrong but i realy want to setup this urlrewriting option. can you provide a simple project and write (or redirect me to help content where this topic is explained) all required configuration setup for both application and IIS.

    thanks for the helps.

  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Apr 2010
    Link to this post
    Hello rck,

    I prepared a sample project that has two pages - abc.aspx and cba.aspx. If you access "abc" you will see cba.aspx page ( the same scenario shown in the video )

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  12. JAllen
    JAllen avatar
    34 posts
    Registered:
    23 Dec 2010
    25 May 2011
    Link to this post
    Hello rck / Ivan,

    Was a solution ever found for this?  I'm getting very similar problems.  I've managed to get a simple rewrite to work locally via the Visual Studio dev server, but as soon as I go via IIS, it breaks giving the same 404 you seemed to be experiencing.

    For me, using this code:
    <urlrewrites>
      <rule>
        <url>/home1</url>
        <rewrite>/home</rewrite>
      </rule>
    </urlrewrites>

    gives this error:

    Detailed Error Information
    Module IIS Web Core
    Notification MapRequestHandler
    Handler StaticFile
    Error Code 0x80070002
    Requested URL http://localhost:80/home1
    Physical Path C:\SourceCode\Published\03urlRewriteTest\home1
    Logon Method Anonymous
    Logon User Anonymous

    It doesn't appear my solution is being rewritten at all as the physical path is still the source url, whereas it looks like yours was being rewritten, just not being found.

    Any ideas anyone?
  13. JAllen
    JAllen avatar
    34 posts
    Registered:
    23 Dec 2010
    25 May 2011
    Link to this post
    I can also now confirm exactly the same happens for Ivan's test project.  As soon as I go via IIS rather than Visual Studio's built in dev server, it breaks and gives the 404.

    Ivan, can you confirm your solution works via IIS?
  14. JAllen
    JAllen avatar
    34 posts
    Registered:
    23 Dec 2010
    25 May 2011
    Link to this post
    One final point, I tried removing all the references to the Telerik AdvancedUrlRewriter and added them via IIS.  Doing this, I get the same behavior as rck in that the requested page does appear to be correct, but Sitefinity somehow can't find it.

    Using this code:
    <system.webServer>
    ...
      <rewrite>
        <rules>
          <rule name="RewriteUserFriendlyURL1" patternSyntax="ECMAScript" stopProcessing="true">
            <match url="^abc$" />
            <conditions>
              <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
            <action type="Rewrite" url="home.aspx" />
          </rule>
        </rules>
      </rewrite>
    </system.webServer>

    I get this error:

    The resource cannot be found.

    Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.
    Requested URL: /home.aspx


    So it appears Telerik's rewriter breaks in IIS and the IIS rewriter breaks in Sitefinity  :(  Please help me find a solution for this as this is critical for my project.

    Thanks again,
  15. JAllen
    JAllen avatar
    34 posts
    Registered:
    23 Dec 2010
    26 May 2011
    Link to this post
    I've found the solution myself.  Gabe's video is fairly old and must not be compatable with IIS7.  He references making a change from CmsHttpModule to CmsHttpModuleUrlRewrite in this section:

    <system.web>
    <httpModules>
    <add name="Cms" type="Telerik.Cms.Web.CmsHttpModuleUrlRewrite, Telerik.Cms"/>
    </httpModules>
    </system.web>

    but it appears in IIS7 this doesn't work.  Ivan's post here: http://www.sitefinity.com/devnet/forums/sitefinity-3-x/general-discussions/url-rewriting-only-works-locally.aspx#1481120 made me realize this is incorrect for IIS7 and once I added it to this section, it works:

    <system.webServer>
     <modules>
    <add name="Cms" type="Telerik.Cms.Web.CmsHttpModuleUrlRewrite, Telerik.Cms"/>
     </modules>
    </system.webServer>

Register for webinar
15 posts, 0 answered