php.htaccessslim

Slim routes not working on server


I'm creating REST API in php slim framework and i was using it just fine. Locally everything is running perfect but I'm having trouble with running it online. I have server from university where there are a lot of student projects so route to my rest api is:

/var/www/projects/myProject/bpsql

In bpsql folder there are public, vendor and app folder with composer.json file. In my public file there is htaccess file which is causing trouble (I think). How should that file look, do you think i should change something from this:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

I tried with adding line RewriteBase projects/myproject/bpsql/publicbut nothing has worked.

Any help would be greatly appreciated!

Edit:

apache modules on server got by `print_r(apache_get_modules());



     Array
(
    [0] => core
    [1] => mod_log_config
    [2] => mod_logio
    [3] => mod_version
    [4] => prefork
    [5] => http_core
    [6] => mod_so
    [7] => mod_alias
    [8] => mod_auth_basic
    [9] => mod_authn_file
    [10] => mod_authz_default
    [11] => mod_authz_groupfile
    [12] => mod_authz_host
    [13] => mod_authz_user
    [14] => mod_autoindex
    [15] => mod_cgi
    [16] => mod_deflate
    [17] => mod_dir
    [18] => mod_env
    [19] => mod_mime
    [20] => mod_negotiation
    [21] => mod_php5
    [22] => mod_reqtimeout
    [23] => mod_rewrite
    [24] => mod_setenvif
    [25] => mod_ssl
    [26] => mod_status
)
/var/www    //echo getenv("DOCUMENT_ROOT") ;

Solution

  • Ok, figured the problem so if someone in future encounters same problem, this fixed it for me:

    1. Enabling rewrite module in apache (Martin's answer)
    2. In httpd conf file i changed AllowOverRide None to AllowOverride All

    Special thanks to @David Pastore for all the help and assistance in figuring out the problem.