• GoDaddy Community
  • Managed WordPress Hosting
  • Managed WordPress Hosting

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 

    Rewriting URLs with web.config: Error 404

    Hi.

    I have a website, and I have tried to implement a simple web.config to rewrite URLs to remove file extensions:

     

    <rule name="RedirectUserFriendlyURL1" stopProcessing="true">
        <match url="^(.*)\.(.*)$" />
        <conditions>
            <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
        </conditions>
        <action type="Redirect" url="{R:1}" appendQueryString="false" />
    </rule>
    <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
        <match url="^(.*)$" />
        <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
        <action type="Rewrite" url="{R:1}.html" />
        <action type="Rewrite" url="{R:1}.php" />
        <action type="Rewrite" url="{R:1}.htm" />
        <action type="Rewrite" url="{R:1}.php3" />
    </rule> 

    However if I try to go to a page without the extension, I get this error:

     

     

    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.

    It works if I give it the proper extension, but if I don't, it gets angry.

    How do I fix this?

    Is it just some stupid mistake I made in the web.config file, or do i have to do something else as well?

     

    My Website: Squishling's Site



    0 REPLIES 0