title: Why is Ajax request by default searching for index.php file in directory instead of specified path?
body: <p><strong>This is my folder structure:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/xEpNs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xEpNs.png" alt="This is my folder structure"></a>
  This is my .htaccess code:</p>
  
  <pre><code>RewriteEngine on
  
  # redirect all requests except only POST
  RewriteCond %{REQUEST_METHOD} !POST
  RewriteCond %{THE_REQUEST} \s/+(.*?/)?(?:index)?(.*?)\.(?:php?)[\s?/] [NC]
  RewriteRule ^ /%1%2 [R=302,L,NE]
  
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]
  
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteRule ^(.+?)/?$ $1.php [L]
  
  Allow from all
  
  # disable directory browsing
  Options All -Indexes
  </code></pre>
  
  <p><strong>This is my AdController.js Code:</strong></p>
  
  <pre><code>$(document).ready(function()
    {
      $("body").on("change click keypress", "select#state",function() 
          {
              var state_id = $("#state").val();
  
              var host = window.location.hostname;
  
              if(state_id != "")
                  {
                      $.ajax({
                              url: '/manage/modules/Controllers/ControllerRequestHandlers/AddRequestHandler.php?id=getCity',
                              type: 'POST',
                              dataType: 'html',
                              data: {state_id : state_id},
                          })
                          .done(function(resp)
                              {
                                  $("#city").html("&lt;option value='' selected disabled&gt;Select State To List Cities&lt;/option&gt;");
                                  $("#city").append(resp);
                              })
                          .fail(function()
                              {
                                  console.log("error");
                              });
                  }
          });
  });
  </code></pre>
  
  <p><strong>This is my AddRequestHandler.php Code:</strong></p>
  
  <pre><code>&lt;?php
      if(isset($_SESSION['user_id']) AND !empty($_SESSION['user_id']) AND isset($_SESSION['role']) AND !empty($_SESSION['role']))
          {
              if(extract($_POST) &gt; 0)
                  {
                      $id = $_GET['id'];
  
                      switch($id)
                          {
                              case 'getCity':
                              echo $add-&gt;listCities($_POST['state_id']);
                              break;
  
                              default:
                              // echo "None";
                              break;
                          }
                  }
          }
      else 
          {
              header("Location: ../../index.php");
          }
  ?&gt;
  </code></pre>
  
  <p><strong>This is my frontend page code: (create_city.php - Present in the modules folder)</strong></p>
  
  <pre><code>&lt;?php
    if(isset($_SESSION['user_id']) AND !empty($_SESSION['user_id']) AND isset($_SESSION['role']) AND !empty($_SESSION['role']))
        {
  ?&gt;
          &lt;!DOCTYPE html&gt;
          &lt;html&gt;
            &lt;head&gt;
              &lt;?php
                  include("/modules/Controllers/AddController.php");
                  include("title_meta_css.php");
              ?&gt;
            &lt;/head&gt;
            &lt;body class="skin-blue sidebar-mini"&gt;
              &lt;div class="wrapper"&gt;
                &lt;?php include("header.php"); ?&gt;
                &lt;!-- Left side column. contains the logo and sidebar --&gt;
                &lt;?php include("sidebar.php"); ?&gt;
                &lt;!-- Content Wrapper. Contains page content --&gt;
                &lt;div class="content-wrapper"&gt;
                  &lt;!-- Content Header (Page header) --&gt;
                  &lt;section class="content-header"&gt;
                    &lt;h1&gt;
                      Control Panel
                      &lt;small&gt;Create City&lt;/small&gt;
                    &lt;/h1&gt;
                    &lt;ol class="breadcrumb"&gt;
                      &lt;li class="active"&gt;&lt;a href="dashboard"&gt;Dashboard&lt;/a&gt;&lt;/li&gt;
                      &lt;li class="active"&gt;Create City&lt;/li&gt;
                    &lt;/ol&gt;
                  &lt;/section&gt;
                  &lt;!-- Main content --&gt;
                  &lt;section class="content"&gt;
                    &lt;!-- general form elements --&gt;
                    &lt;div class="box box-primary"&gt;
                      &lt;div class="box-header"&gt;
                        &lt;h3 class="box-title"&gt;Create New City&lt;/h3&gt;
                      &lt;/div&gt;&lt;!-- /.box-header --&gt;
                      &lt;!-- form start --&gt;
                      &lt;form role="form"&gt;
                        &lt;div class="box-body"&gt;
                          &lt;div class="form-group col-xs-12 col-md-6"&gt;
                            &lt;label&gt;Select State To List Cities&lt;/label&gt;
                            &lt;select required id="state" class="form-control"&gt;
                              &lt;option value="" selected disabled&gt;Select State&lt;/option&gt;
                              &lt;?php $add-&gt;listStates(); ?&gt;
                            &lt;/select&gt;
                          &lt;/div&gt;
                          &lt;div class="form-group col-xs-12 col-md-6"&gt;
                            &lt;label&gt;Select City&lt;/label&gt;
                            &lt;select required id="city" class="form-control"&gt;
                              &lt;option value="" selected disabled&gt;Select State To List Cities&lt;/option&gt;
                            &lt;/select&gt;
                          &lt;/div&gt;
                          &lt;div class="checkbox text-justify col-xs-12 col-md-12"&gt;
                            &lt;label&gt;
                              &lt;input id="user-status" type="checkbox"&gt; Click the checkbox to set the city &lt;b&gt;Active&lt;/b&gt;, else leave it unchecked to be deactivated and activate it later.
                            &lt;/label&gt;
                          &lt;/div&gt;
                        &lt;/div&gt;&lt;!-- /.box-body --&gt;
                        &lt;div class="box-footer"&gt;
                          &lt;button type="submit" id="user-create" class="col-xs-12 col-md-4 col-md-offset-4 btn btn-success"&gt;Create City&lt;/button&gt;
                        &lt;/div&gt;
                      &lt;/form&gt;
                    &lt;/div&gt;
                  &lt;/section&gt;&lt;!-- /.content --&gt;
                &lt;/div&gt;&lt;!-- /.content-wrapper --&gt;
                &lt;?php
                  include("footer.php");
                  //include("right-sidebar.php");
                ?&gt;
              &lt;/div&gt;&lt;!-- ./wrapper --&gt;
              &lt;?php include("scripts.php"); ?&gt;
              &lt;script src="&lt;?php echo $site_url; ?&gt;modules/Controllers/ControllerScripts/AddController.js"&gt;&lt;/script&gt;
            &lt;/body&gt;
          &lt;/html&gt;
  &lt;?php
        }
    else 
        {
          header("Location: ../index.php");
        }    
  ?&gt;
  </code></pre>
  
  <p>In the create_city.php the $site_url variable holds the value <strong>www.vendor.com/manage/</strong>
  where www.vendor.com is my virtual host created in WAMP Server</p>
  
  <p>The problem is whenever i am making an ajax request from the create_city.php page it shows me the error in the following snapshot below</p>
  
  <p><a href="https://i.stack.imgur.com/hND7b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hND7b.png" alt="Showing error like file not found"></a></p>
  
  <p>When i am providing the correct path in AddController.js, why is it stopping the control in modules folder that too it is by default searching for the file index</p>
  
  <p>i don't know why this is happening. Please can anyone help me out with this bug..</p>