title: .htaccess Page Redirect is Having Effect on AJAX Response
body: <p>I am working on social networking site that works like Facebook. Posts are displayed on the home page. They can be liked and commented on. 
  If a post is liked, the <strong>LIKE TABLE</strong> gets updated via AJAX and have its like count incremented by one. The <code>likes.php</code> file updates the 
  LIKE TABLE and returns the incremented value, <code>&lt;span class = 'likeCount'&gt;. $likeCount .&lt;/span&gt;</code>, and have it appended to the like button. </p>
  
  <p>This works fine in <code>home.php</code> but not on <code>user.php</code> which is the user profile page. The <code>user.php</code> fetches posts that are only related to a specific user. You get PHP errors
  whenever you try to like or comment on a post in <code>user.php</code> page. When I <code>alert( msg );</code> it shows the entire HTML code of the requesting page, <code>user.php</code> with PHP errors that some variables are undefined. The URL is actually like this <code>http://localhost/mysite/user.php?userID=yax</code> but it is redirected and rewritten by .htaccess as <code>http://localhost/mysite/user/yax</code>. I guess it is the one causing the problem because the same AJAX is working fine in home.php. </p>
  
  <p><strong>AJAX code:</strong></p>
  
  <pre><code>$(".mlike").click(function () {
      $(".murconform").submit(function(e){
          return false;
      });
      var $this=$(this);
      var post_id = $(this).val();
      var user_id = $(".user_id").text();
      alert('Post: '+post_id +' User: '+user_id);
      var request = $.ajax({
        url: "likes.php",
        type: "POST",
        data: { post : post_id , user : user_id },
        dataType: "html"
      });
      request.done(function( msg ) {    
          $this.prev('.likecount').html( msg ); 
      });
  });
  </code></pre>
  
  <p><strong>.htaccess code:</strong></p>
  
  <pre><code>RewriteEngine  on
  RewriteBase /mysite/user/
  
  RewriteCond %{THE_REQUEST} /user\.php\?user=([^\s&amp;]+) [NC]
  RewriteRule ^ %1? [R=302,L]
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ user.php?user=$1 [L]
  </code></pre>
  
  <p>This has really frustrated and halted my work for the past three days. Any help will be appropriately appreciated. Thanks.</p>