skip to Main Content

I am using Lumen for the first time. I placed my lumen files in folder Test and kept the folder inside /var/www/html path in server. My PHP version is 7.4.3

I have the following routes:

$router->get('/key', function() {
return str_random(32);
});

$router->get('/', function () use ($router) {
return $router->app->version();
});

Below is my htaccess:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

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

But whenever I try to access http://xx.xxx.xxx.xxx/Test/public/key it shows

The requested URL was not found on this server.

But if I try to access http://xx.xxx.xxx.xxx/Test/public/ it returns me

Lumen (5.7.8) (Laravel Components 5.7.*)

How can I make all other routes also to work?

2

Answers


  1. Chosen as BEST ANSWER

    I searched for < Directory /var/www/ > in /etc/apache2/apache2.conf file and changed the below

    AllowOverride None 
    

    to

    AllowOverride All
    

    and restarted the apache. It solved my issue.


  2. It seems rewrite rule is disabled

    sudo a2enmod rewrite

    sudo service apache2 restart

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search