title: Apache - htaccess 500 internal server error
body: <p>I'm learning how to make PHP MVC applications, and the tutorial I followed involved creating two <code>.htaccess</code> files - one to prevent a user from navigating to the application folders and files; the other to rewrite how the URL is presented in order for me to parse and retrieve controllers, methods and parameters.</p>
  
  <p>When deploying these files on my XAMPP server, they work correctly. However, when deploying these files on to my university server via FTP, the <code>500 Internal Server Error</code> appears, and removing these files will allow me to see my application. But I need these files otherwise I can't call the appropriate controllers, models and views.</p>
  
  <p>I have searched around for the answer, and many solutions say that there could be syntax errors, which I don't believe I have any as it works on the XAMPP instance just fine. The other answers were that the server itself may not be configured to allow me to upload such files or something similar.</p>
  
  <p>I do not have access to the configuration of my university's server, which I know may hinder any solutions you could provide to me. So, if there are any PHP solutions to <strong><em>at least</em></strong> let me parse the URL the way I need to, I'll be happy to drop the <code>.htaccess</code> files.</p>
  
  <p>The first <code>.htaccess</code> file, located within the app directory of the application:</p>
  
  <pre><code>Options -Indexes
  </code></pre>
  
  <p>The second <code>.htaccess</code> file; located within the public directory of my application:</p>
  
  <pre><code>Options -MultiViews
  RewriteEngine On
  
  RewriteBase /~21249593/Internet_Technologies/Element_2/public
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  
  RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
  </code></pre>
  
  <p>The PHP class used to parse the URL to call the appropriate controller and its method, I have posted the full logic so you can understand <em>how</em> the parsing works:</p>
  
  <pre><code>class App {
      protected $controller = 'home';
      protected $method = 'index';
      protected $params = array();
  
      public function __construct() {
          $url = $this-&gt;parseUrl();
  
          if (file_exists('../app/controllers/' . $url[0] . '.php')) {
              $this-&gt;controller = $url[0];
              unset($url[0]);
          }
  
          require_once '../app/controllers/' . $this-&gt;controller . '.php';
  
          $this-&gt;controller = new $this-&gt;controller;
  
          if (isset($url[1])) {
              if (method_exists($this-&gt;controller, $url[1])) {
                  $this-&gt;method = $url[1];
                  unset($url[1]);
              }
          }
  
          $this-&gt;params = $url ? array_values($url) : array();
  
          call_user_func_array([$this-&gt;controller, $this-&gt;method], $this-&gt;params);
      }
  
      public function parseUrl() {
          if (isset($_GET['url'])) {
              return $url = explode('/', filter_var(rtrim($_GET['url'], '/'), FILTER_SANITIZE_URL));
          }
      }
  }
  </code></pre>
  
  <p>I appreciate any help you can give me here</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I should've stated that XAMPP is using 2.4.9 Apache, the FTP is 2.2.3</p>