title: Set RewriteBase to the current folder path dynamically
body: <p>Is there any way to set RewriteBase to the path current folder (the folder which the .htaccess file is in) relative to the host root?</p>
  
  <p>I have a CMS and if I move it to the directory in my host it does not work unless I set the RewriteBase to the path of directory relative to the root of host. I would like my CMS to work with only copy and paste, without changing any code in htaccess.</p>
  
  <h2>Update:</h2>
  
  <p>For example:</p>
  
  <pre><code>webroot
  
   - sub_directory
   - cms
   - .htaccess
  </code></pre>
  
  <p>in this case I should write in the htaccess: <code>RewriteBase /</code></p>
  
  <p>and if I move the htaccess inside sub_directory I should change RewriteBase to: </p>
  
  <p><code>RewriteBase /sub_directory/</code> </p>
  
  <p>So I want something like</p>
  
  <p><code>RewriteBase /%{current_folder}/</code></p>