title: AJAX works locally; 404 on production
body: <p>I have a Laravel application that works perfectly locally, but every AJAX call returns 404 when hosted. I'm unsure if this is from a sever config error, a missing php.ini setting, or something else? I've included an example of a failing call.</p>
  
  <p>AJAX/JQ:</p>
  
  <pre><code>var url = "/final-review";
  $("#review_note_text").change(function(){
    $.ajaxSetup({
      headers: {
        'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
      }
    });
  
    $('#review_note_loader').show();
  
    var formData = {
      note_text: $('#review_note_text').val(),
    };
  
    var type = "POST";
    var reviewNoteUrl = url + '/review-note';
  
    $.ajax({
      type: type,
      url: reviewNoteUrl,
      data: formData,
      dataType: 'json',
      success: function (data) {
        $('#failure-message-review').hide();
        $('#success-message-review p').html("Saved successfully" + '&lt;a href="#" class="close" data-dismiss="alert" aria-label="close"&gt;&amp;times;&lt;/a&gt;');
        $('#success-message-review').show();
        $('#review_note_loader').removeClass("halted-loader").hide();
      },
      error: function (data) {
        $('#review_note_loader').addClass("halted-loader");
        $('#failure-message-review p').html("Something went wrong, your record was not updated. &lt;strong&gt;Error Code: " + data.status + "&lt;/strong&gt;" + '&lt;a href="#" class="close" data-dismiss="alert" aria-label="close"&gt;&amp;times;&lt;/a&gt;');
        $('#failure-message-review').show();
      }
    });
  
  });
  </code></pre>
  
  <p>My Corresponding Route:</p>
  
  <p><code>Route::post('final-review/review-note', 'FinalReviewController@update_review_note');</code></p>
  
  <p>Controller Function</p>
  
  <pre><code>  public function update_review_note(Request $request){
  
      $validatedData = $request-&gt;validate([
        'note_text' =&gt; 'nullable|string',
      ]);
  
      $note = \App\ReviewNote::create([
        'note_text' =&gt; $request-&gt;get('note_text'),
        'author' =&gt; Auth::user()-&gt;name,
        'created_at' =&gt; now()
      ]);
  
      return Response::json($note);
    }
  </code></pre>
  
  <p><strong>SOLVED:</strong></p>
  
  <p>I had to change the "url" var in my blade template to be:
  <code>var url = "{{ url('/final-review') }}";</code></p>
  
  <p>In my AJAX I was defining "url" as "/final-review", which led to a route of "foobar.com/final-review/params" what I really needed was "foobar.com/app-name/final-review/params".</p>
  
  <p>Testing locally, I did not have "app-name" in my URL.</p>