i have enable permalinks on my wordpress site and now every page returns 404 error. The site is hosted in IIS 8.5

the web.config file has the following rule inside

<?xml version="1.0" encoding="UTF-8"?>

<directoryBrowse enabled="false"/>
        <rule name="wordpress" stopProcessing="true">

      <match url=".*" />

      <conditions logicalGrouping="MatchAll">

        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />

        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />


      <action type="Rewrite" url="index.php" />


what can i do to fix that and make permalinks work?

  • Go to settings > permalinks and save the changes again. If your .htaccess is not writable, copy the codes mentioned at the bottom of the page to your .htaccess file. Make sure mod_rewrite is enabled on your server.
    – Annapurna
    Commented Sep 19, 2017 at 6:26

2 Answers 2


For permalinks to work, you need to resave the permalinks in the permalinks admin section of WP. The same applies when you change the url structure, even if permalinks were already in use.

  • You should write this as a comment, a answer. Commented Sep 18, 2017 at 11:08
  • i considered that but this is an answer to the question. if you want to suggest improvements, i'd be happy to know them.
    – inarilo
    Commented Sep 18, 2017 at 14:09
  • Re saving my permalinks in this state resulted in the entire site to produce HTTP Error 500.19 - Internal Server Error. Why was that the case? Commented Mar 16, 2020 at 18:15
  • What changes did you make before that?
    – inarilo
    Commented Mar 17, 2020 at 19:24

You need to put this code <?php flush_rewrite_rules( True ); ?> inside your functions.php file to flush the rewrite rules.

Reference codex.wordpress.org

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.