URL rewriting does not seem to work. If you add index.php to the url right before /api , will this work?
For example, yourdomain.com/api will become yourdomain.com/index.php/api , and if the second URL works, then rewriting does not work.
If your rewriting does not work, but you have a .htaccess file in your public directory, you probably need to allow overrides in your Apache configuration. Here is an example virtual host configuration for Lumen on Ubuntu.
I marked the lines that need to be changed. Change the first and third to point to the public directory in your website directory. Then change the second line to the domain name that you use on your website.
<VirtualHost *:80> DocumentRoot "/var/www/lumen/public" # Change this line ServerName yourdomain.com # Change this line <Directory "/var/www/lumen/public"> # Change this line AllowOverride All # This line enables .htaccess files Order allow,deny Allow from all </Directory> </VirtualHost>
You will need to restart Apache for these settings to take effect.
The best way
Including the .htaccess file should work, but using .htaccess slows down your site. The best solution is to put the contents of the .htaccess file in your virtual host and then disable the .htaccess files.
An example virtual host configuration for this is as follows:
<VirtualHost *:80> DocumentRoot "/var/www/lumen/public" # Change this line ServerName yourdomain.com # Change this line <Directory "/var/www/lumen/public"> # Change this line # Ignore the .htaccess file in this directory AllowOverride None # Make pretty URLs <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> </Directory> </VirtualHost>
Once again, you will need to restart Apache for these settings to take effect.
Brokenbinary
source share