skip to Main Content

My development environment is

Ubuntu 14.04.6 LTS

Apache 2.4.7

mysql is 5.6.33

my directory is

/var/www/html/your-app
                   |--public
                   |-- .htaccess
                   |      `-- index.php
                   `--app
                       |-- src
                       |    |-- controllers
                       |    |       `-- WebController.php
                       |    `-- models
                       |            `-- WebModel.php
                       |-- templates
                       |    |-- main.html
                       |    `-- signup.html
                       |-- dependencies.php
                       |-- middleware.php
                       |-- routes.php
                       `-- settings.php

The root path of the slim framework works fine.

my_slim_url/index.php

my_slim_url

// load the same page

However, to move to another link on my main screen like this

my_slim_url/signup

this message,

'The requested URL / register_email was not found on this server.' 

is displayed.

I’ve tried all of the answers on stackoverflow, but they didn’t work.

Here are some my server’s code that might be helpful.

If you tell me there have any problems or fixes that I have not found so far,

I would be grateful to your help.

I hope everyone to coding without error… 😀

apache2.conf

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

<Directory /var/www/html/public>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

<ifModule dir_module>
    DirectoryIndex index.php
</ifModule>

AccessFileName .htaccess

<FilesMatch "^.ht">
    Require all denied
</FilesMatch>

/sites-available/000-default.conf

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Require all granted
 </Directory>

<Directory /var/www/html/your-app/public>
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

/var/www/html/your-app/pulbic/.htaccess

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

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

2

Answers


  1. Chosen as BEST ANSWER

    I solved this problem!!!!!

    First, Run this fucntion:

    $ sudo a2enmod rewrite
    

    Second, Check your's apache2.conf directory url:

     <Directory /var/www/html/public>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    

    it was, and i changed like this,

    <Directory /var/www/html/your-app/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    

    Third, Restart your apache service

    $ sudo service apache2 restart
    

    then, it works!!!!

    thank you for everyone to answered my question!!! :D


  2. As per the Slim Framework user guide, your .htaccess (at /var/www/html/your-app/public/.htaccess) should contain:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ index.php [QSA,L]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search