title: Backbone and slim framework redirect route htacces
body: <p>I'm trying to configure htaccess for my backbone and slim Webapp.</p>
  
  <p>Here is my root url:  <code>mysite.com/myproject/</code></p>
  
  <p>Here is how I'm organizing my directories:</p>
  
  <p><img src="https://i.stack.imgur.com/Wfm7l.jpg" alt="directories"></p>
  
  <ul>
  <li><code>server.php</code>, where I use Slim framework, and define my 'routes'</li>
  <li>one directory that contains Slim framework called <code>data</code></li>
  <li>one directory that contains my Backbone app called <code>js</code></li>
  </ul>
  
  <p>I would like do something like <code>mysite.com/myproject/post</code>s to get full list of my posts
  or <code>mysite.com/myproject/post/:id</code> to get one post</p>
  
  <p>I know that I can use redirect to "simulate" URLs that do not exist.
  In theory if I try <code>mysite.com/posts</code>, Apache/<code>.htaccess</code> redirect to <code>server.php</code> where my "routes" do what I want and return my result to backbone.</p>
  
  <p>But whatever I've tried, does seem to work.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've find part of solution.</p>
  
  <p>I moved htaccess and server.php files into data directorie.</p>
  
  <p>Here is my server.php file<br/></p>
  
  <pre><code>&lt;?php
      require_once("Slim/Slim.php");
      $app = new Slim();
  
      $app-&gt;get('/posts','getPosts');
      $app-&gt;get('/post/:id','getPost');
  
      $app-&gt;run();
  
      function getPosts() { echo "Hello world, get post list"; }
      function getPost($id) { echo "Hello world, get one post = ".$id; }
  ?&gt;
  </code></pre>
  
  <p>Here is my backbone collection declaration</p>
  
  <pre><code>window.PostList = Backbone.Collection.extend({
          model : Post,
          url:"data/posts",
  
          initialize : function() {
              console.log ("collection created.")
          }
      });
  </code></pre>
  
  <p>And .htaccess file</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /myproject/data
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ server.php [QSA,L]
  </code></pre>
  
  <p>On <code>fetch method</code> of backbone, request was sent to <code>http://mysite.com/myproject/data/posts</code>
  and i can see response into console <code>Hello world, get post list</code></p>
  
  <p>but i can't do request like <code>mysite/myproject/posts</code>
  which value for <code>RewriteBase</code> ? which value for <code>backbone collection</code> ?</p>