13

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 ?

3
  • I'm not sure why the japi config is being ignored, however you can follow some tips here and take a look at this article.
    – phatskat
    Jan 26, 2018 at 16:13
  • 1
    What is this file? If you're handling API requets in WordPress you should use the REST API or AJAX hooks. Mar 22, 2018 at 2:34
  • 1
    How do you know it is being neglected? The sample looks exactly like the standard web.config for WordPress and if that's the case, the behavior will be exactly the same as the one in the project root. Can you please rephrase the question as Given x When y I Expect z But Instead See ___? Apr 14, 2019 at 3:15

1 Answer 1

0

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.

Your Answer

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

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