0

I've been trying to run a project in progress on a live environment, but just can't get the .htaccess right. In despite to most people, we decided to not use things like $url, but instead do it like this:

    $url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null;
    $url = ltrim($url, '/');
    $url = rtrim($url, '/');
    $url = filter_var($url, FILTER_SANITIZE_URL);
    $this->_url = explode('/', $url);

The .htaccess exists of:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/ [L,QSA]

Anyone has an idea of what I'm doing wrong? I'm aware of my noobness in php and even more noob in the .htaccess file, but I'd very much like to have this fixed, especially with the future in mind :p

tereško
  • 58,060
  • 25
  • 98
  • 150
  • 1
    Just use a proper router like [this](https://github.com/nikic/FastRoute) or [this](http://symfony.com/doc/current/components/routing.html), instead of trying to bang two rocks together. – tereško Nov 23 '17 at 22:34
  • Sadly, this is a school project and we may only use what we make ourselves. Usually I'd use something similar to that, but we're not allowed to – Remy Van Lis Nov 23 '17 at 23:19
  • 1
    In that case, maybe [this post](https://stackoverflow.com/a/19309893/727208) will help a bit further down the line. – tereško Nov 23 '17 at 23:49
  • That was indeed a very nice post and I could absolutely learn something from it, thanks a lot for that. The problem though, appeared to be me being an idiote not knowing that I had to sync my .htaccess file. That makes me feel more of an idiote than I did before, but okay then ;p Thanks a lot for the useful reactions! – Remy Van Lis Nov 24 '17 at 00:38

1 Answers1

0

The problem appeared to be me being an idiote not knowing that I had to sync my .htaccess file. pff...