The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

Slim and htaccess / mod_rewrite issue

Juanes's Avatar

Juanes

26 Jun, 2012 09:40 AM

I'm having trouble making Slim work with this specific project, the folder structure is like this:

project
- src (main source files) - vendor (some libraries) - webroot (webroot js files images etc)

In the webroot folder I'm using the default .htaccess file that ships with Slim:

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

And when the server's document root is set to project/webroot everything runs fine. But I'm currently unable to change the document root in the production server and so it is the project/ folder. So I created this .htaccess file there:

RewriteEngine On
RewriteRule    ^$    webroot/    [L]
RewriteRule    (.*) webroot/$1    [L]

This is supposed to redirect everything to the webroot folder, and it does, but Slim will always show the / route, even if the requested route does not exist.

/ -> loads / /route-does-not-exist -> loads / /route-exists -> loads /

I tried different htaccess settings but I haven't been able to make it work, can anyone give some advice?

Showing page 2 out of 2. View the first page

  1. 31 Posted by qiyobeta on 05 May, 2017 07:48 AM

    qiyobeta's Avatar

    We will describe you in detail about the folder description.
    http://newbodydietplan.com/

  2. 32 Posted by Oleksandr Snitk... on 05 May, 2017 09:51 AM

    Oleksandr Snitko's Avatar

    С уважением,
    Снитко Александр
    +38(095) 210-3802
    skype: a.snitko (Thailand)
    https://ua.linkedin.com/in/osnitko
    www.proinsurer.com.ua

  3. 33 Posted by Matteo Favaro on 05 May, 2017 10:09 AM

    Matteo Favaro's Avatar

    ---
    Matteo Favaro
    Email Principale: matteofavaro (at) gmail.com
    Cell sui: +41 767396933

  4. 34 Posted by pitozova on 06 May, 2017 01:03 AM

    pitozova's Avatar

    We are giving all the advice to the people.
    http://manifestationreview.com/

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? 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