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

Rewrite Rule Slim 2

Madley's Avatar


24 Dec, 2015 11:57 AM

I'm on Slim Framework 2.
I need to add "v1" to the path url in case it is not present.
So: ->

I must use rewrite rule and not redirect, 'cause I need to preserve POST and GET data.
So I've added the following .htaccess:

RewriteRule !^/?v1(/.*)?$ /v1%{REQUEST_URI} [NC,L]

If I print:


I get the path missin 2 characters, so:

Slim 3, works fine, but I can't upgrade at the moment. So, what am I missing here? Many thanks.

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


? 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