The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.

slim doesn`t match route

t.engels's Avatar


29 May, 2012 01:53 PM


i am new to slim and have a little problem...

i have code like

` $.ajax({

     type: "GET",
     dataType : 'json',
     url: '',
     success: function.....

slim index: $app = new Slim(); $app->get('/login', 'loginUser'); $app->get('/', 'returnTrue'); ...

... $app->run(); `

the filepath is correct but slim allwas uses the '/' route instead of the '/login' route..
I tried several things but cant get a solution....
As you can see i have HTTPS but i cant imagine that this is a problem.

RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L]

  1. Support Staff 1 Posted by Andrew Smith on 29 May, 2012 01:59 PM

    Andrew Smith's Avatar

    Is your codebase on Github or somewhere I can take a look at it? are your Slim files in directory project/api/ ? do you have a


    in your .htaccess file?

  2. 2 Posted by t.engels on 30 May, 2012 06:21 AM

    t.engels's Avatar


    sorry my code is not on free te look at.

    My project directory is like
    The Slim api dir is directly
    In this directory I have the .htaccess with

    # RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L]

    In the index.php of Slim/ i got:
    require 'Slim/Slim.php'; $app = new Slim(); $app->get('/login/:user/:pw', 'loginUser'); $app->get('/', 'someFunction');

    Ajax call :

         type: "GET",
         dataType : 'json',
         url: ''+$('#user').val()+'/'+MD5($('#password').val()),

    success: function(data) {alert('succez'+JSON.stringify(data)+"end")},

    I try to ajax the url from (with backbone.js)
    The Ajax call is ok so i dont think it`s the .htacces that fails, but it always returns the result of "someFunction" instead of loginUser

    I hope this helps.

  3. 3 Posted by t.engels on 31 May, 2012 07:25 AM

    t.engels's Avatar

    Andrew thanks for replying, i got the solution in between.
    Simple solution: Our sysadmin put on mod_rewrite on http but not on https ...d`oh !!

  4. t.engels closed this discussion on 31 May, 2012 07:25 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac