Forums

Problems with permalinks after updating web.config file (4 posts)

  1. philbonsai
    Member
    Posted 1 year ago #

    Hi

    I am having a little trouble with navigating my site. I changed the permalink to show %pagename% but kept getting 404s. Upon realizing that write permissions were not enabled, we copied and pasted the following code into the web.config file.

    <rewrite>
          <rules>
    				<rule name="wordpress" patternSyntax="Wildcard">
    					<match url="*"/>
    						<conditions>
    							<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
    							<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
    						</conditions>
    					<action type="Rewrite" url="index.php"/>
    				</rule></rules>
        </rewrite>

    As a result, the permalinks worked and the navigation went smoother. After creating new posts however, 404s still appeared. I went back and added write permissions to the web.config file, updated the permalinks settings and I was informed the structure was updated. These posts are still showing 404 when using the page name, but not when using page_id. I commented out some extra code in the web.config file

    <!--<directoryBrowse enabled="false"/>
        <defaultDocument>
          <files>
            <clear/>
            <add value="Default.htm"/>
            <add value="Default.asp"/>
            <add value="index.htm"/>
            <add value="index.html"/>
            <add value="iisstart.htm"/>
            <add value="default.aspx"/>
            <add value="index.php"/>
          </files>
        </defaultDocument>-->

    but not sure if this has anything to do with it. I'd appreciate any help that can be provided. Thanks!

  2. Leolima
    Member
    Posted 5 months ago #

    hello.. i am got a similar error..
    some days ago i can acess a single file .html (example.html) directly the browser --> http://mydomain.com/example.html,

    but now the file returns a 404 erro in my wordpress.

    looking the solution.

  3. justingreerbbi
    Member
    Posted 5 months ago #

    RewriteCond %{REQUEST_FILENAME} !\.(html)$0

  4. faolie
    Member
    Posted 4 months ago #

    Here's my web.config. Really just a copy from the WP prettylinks page with the addition of a defaultdocument. Works fine.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <rewrite>
        <rules>
            <rule name="Main Rule" stopProcessing="true">
                <match url=".*" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="index.php/{R:0}" />
            </rule>
        </rules>
    </rewrite>
    <defaultDocument>
          <files>
            <clear/>
            <add value="index.php"/>
          </files>
    </defaultDocument>
    <httpErrors errorMode="Detailed" />
    </system.webServer>
    </configuration>

Topic Closed

This topic has been closed to new replies.

About this Topic