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

Issues with Slim 2.6.2, XAMPP, Rewrites, Subfolders, and Routes.

MooK's Avatar

MooK

24 Feb, 2016 05:59 PM

Hi,

I've read more than a handful of posts on this forum about this very issue, but none seem to identify the exact problem that I'm facing.

XAMPP is installed locally to run in C:/xampp, with a DocumentRoot of C:/xampp/htdocs. That's a pretty standard default case. Rewrites are enabled.

I have all of my development work on a separate partition, located here:

M:/development

As a result, I have a symlink between C:/xampp/htdocs/development and M:/development.

I also have a hosts file setup for the following:

localhost 127.0.0.1
localhost.dev 127.0.0.1

My production server will be forced to run PHP 5.3.x, and I do not have control over this, hence my need to use Slim 2.6.x. I don't need Slim 3.0, so I'm quite happy working with 2.6.2.

When I visit my slim installation, I can simply put the following in my address bar:

http://localhost/development/slim-install/public

My hierarchy looks as following:

development
    - slim-install
        - public
            - index.php [$app -> run()]

My .htaccess is also pretty simple:

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

And I do have the following route:

$app -> get('/', function() use ($app) {
    print('Hello World!');
});

When I visit http://localhost/development/slim-install/public I am greeted with a 404 not found error. If I try http://localhost/development/slim-install/public/index.php/ I also receive a 404 not found error. However, if I change the following:

$app -> get('/development/slim-install/public/', function() use ($app) {

I see "Hello World!" and if I revert that change, and set the following:

$_SERVER['REQUEST_URI'] = str_replace($_SERVER['REQUEST_URI'], 'development/slim-install/public/', '');

I also see "Hello World!"

One solution I see is to create a vhost for slim-install.dev to load this specific document root, but I was wondering if there was a better way to run the Slim install in a sub-folder, like this setup, without changing routes or superglobals.

Thank you!

  1. 1 Posted by sagarkhna999 on 11 May, 2016 06:47 AM

    sagarkhna999's Avatar

    good After saving the program, stick to the recommendations by clicking on it. http://snaptubedownloadapps.com it will save in the YouTube itself but one can enjoy nice.

  2. 2 Posted by roman on 25 Nov, 2016 07:08 AM

    roman's Avatar

    good you can look at some of the confetti in the weather. http://bigphotographers.com/ Centering on the point in time is certainly major when you're taking pictures honest occasions. great.

  3. 3 Posted by James on 17 Feb, 2017 10:00 AM

    James's Avatar

    Great Imo application is formally not offered for PC/Desktop. https://imoappz.com/imo-apk-download-install-for-android-free-video-chat These are the 11 features which I have actually Fine.

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