web.config conflict on IIS

folder structure

docroot
  |- wordpress
     |- web.config 
     |- wp-content
        |- japi
           |- index.php
           \- web.config
     ...
  ...

As you can see there are 2 web.config s. One in the wordpress folder and one in wordpress/wp-content/japi folder.

japi/web.config

  rules
    rule name="Imported Rule 1" stopProcessing="true"
      match url="^(.*)$" ignoreCase="false" /
      conditions
        add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /
        add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /
      /conditions
      action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" /
    /rule
  /rules

Now when I request for http://domain.com/wordpress/wp-content/japi/test. The japi/web.config seems to be neglected and only wordpress/web.config is being considered.

How can I fix this ?

Topic rewrite-rules url-rewriting Wordpress

Category Web


I don't have the reputation to comment so I'm sure this may be dumped if not totally complete/accurate; but, doesn't WP work in a way that it goes through the core's index.php file using rewrites and such. This being the case, if you don't specify a specific file that you are accessing, you aren't really playing in that sub-directory.

If you created a file called test.php inside of the directory and accessed that directly then the expected web.config should be used; however, since you are not accessing a specific file directly (and are just using and endpoint and the folder structure - which has rewrite rules in WP), this may be the reason that the web.config file is being ignored and may be the answer to your question.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.