Slim Skeleton htaccess url


#1

Hi, I’m new to Slim framework. I have downloaded slim skeleton project under folder /document_root/api

I able to access API through http://localhost/project/api/public/hello

But I want it to be http://localhost/project/api/hello

What change I have to make in htaccess.


#2

This is mine (put it in the “public” directory.

<IfModule mod_rewrite.c>
Options -MultiViews

RewriteEngine On

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
</IfModule>

and of course your site-enabler (in apache):

<VirtualHost *:80> 
    DocumentRoot "your_full_dir_to_that_public_dir/"
    ServerName project.dev
    ServerAlias *.project.dev
    <Directory ""your_full_dir_to_that_public_dir/">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

#3

Thank U :slight_smile: