URL Rewrite with extension not working in live server (localhost is pretty good) RRS feed

  • Question

  • User944339287 posted

    hi guys, i using URL rewriter in my web.config and it's working pretty good for me when testing in localhost.

    for an instance,

    1) http://localhost/mywebsite/electronics/smartphone/samsung/
    2) http://localhost/mywebsite/electronics/smartphone/samsung/galaxy+core.html 

    but when uploaded to my live server, those links with .html will display error msg (HTTP Error 404.0 - Not Found)

    1) http://www.demo.com/mywebsite/electronics/smartphone/samsung/ (working)
    2) http://www.demo.com/mywebsite/electronics/smartphone/samsung/galaxy+core.html (not working)


    <rewrite url="~/([0-9a-z+]+)/([0-9a-z+]+)/([0-9a-z-]+)/$" to="~/store/product.aspx?parentCatName=$1&amp;childCatName=$2&amp;subchildCatName=$3" /> <rewrite url="~/([0-9a-z+]+)/([0-9a-z+]+)/([0-9a-z-]+)/([0-9a-z+]+).html$" to="~/store/product_detail.aspx?parentCatName=$1&amp;childCatName=$2&amp;subchildCatName=$3&amp;productName=$4" /> </rewriter>

    Saturday, November 9, 2013 8:39 PM

All replies

  • User-801004448 posted

    Are you sure you configure correct Asp.net version and mode for application pool?

    Sunday, November 10, 2013 11:21 PM
  • User944339287 posted

    Hi kctt,

    I have checked my live server is using framework 4.0 and Classic Mode for application pool. (my website not able to run if using integrated mode)

    And my localhost is using framework 4.0 * but not sure how to check mode for application pool (as i using vs2010 to start debug) please advise. tq

    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />

    Monday, November 11, 2013 12:49 AM
  • User944339287 posted

    hi sir, any advise on my problem? and may i know how can i make my website run under integrated mode (application pool) during deployment?

    Monday, November 11, 2013 7:40 PM
  • User-166373564 posted

    Hi kengkit

    but when uploaded to my live server, those links with .html will display error msg (HTTP Error 404.0 - Not Found)

    This problem occurs for one or more of the following reasons:

    • The specified directory or file does not exist on the Web server.
    • The URL contains a typographical error.
    • A custom filter or a custom module restricts access to the file. The filter or the module sends the "HTTP Error 404.0" error message back to the client as a response.

    To resolve this problem, use one of the following methods:

    • Make sure that the requested resource is at the location that the URL points to.
    • Review the URL that you open in the Web browser.
    • Make sure that no custom filters or modules restrict access to the file that you want to browse.

    hope it can give some tips to troubleshoot, moreover, it's also recommended to post this issue to IIS forum(http://forums.iis.net/), more IIS professionals will help you there.


    Monday, November 18, 2013 3:10 AM
  • User-1853252149 posted

    Simple Possibility:

    Is the live server set to serve static files (such as HTML)?


    Tuesday, November 19, 2013 2:11 PM
  • User944339287 posted

    Hi jeff,

    May i find out with you how can i confirm my live server set to serve static file?

    * my live server can open .html with no problem ^^


    Tuesday, November 19, 2013 7:14 PM