Error 404 Invoice Ninja 2.6.8

Hi guys - I am running through a new self-host installation of 2.6.8 as Bitnami have discontinued their Invoice Ninja stacks.

I have migrated my MySQL database and .env file. Mod-rewrite is enabled for Apache2.4 and I have set my document root to /var/www/ninja/public and set the appropriate permissions.

However when browsing to http://IP address I get a 404 error - If I specify /index.php in the URL it works fine. How do I ensure I don’t have to specify index.php?

Many thanks

Scratch that, my bad. Forgot to enable rewrite!

I’ve enabled SSL and have setup my vhost in /default-ssl.conf - What rewrite rule should I use in my .htaccess to ensure it uses SSL?

Many thanks

Current contents of .htaccess

<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]

# In case of running InvoiceNinja in a Subdomain like invoiceninja.example.com,
# you have to enable the following line:
# RewriteBase /

</IfModule>

You can require HTTPS by adding REQUIRE_HTTPS=true to the .env file

I’ve changed that setting, however unless I specify /index.php in the URL I’m directed to the default apache2 page.

Thanks

I’m not sure why, another approach is to add the following to public/.htaccess

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]

https://github.com/invoiceninja/invoiceninja/blob/87095a2da156f3d09c748c44477e96d9ec27038f/public/.htaccess#L16

.htaccess now looks like

<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]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]



# In case of running InvoiceNinja in a Subdomain like invoiceninja.example.com,
# you have to enable the following line:
# RewriteBase /

</IfModule>

Same issue, unless I specify index.php in the URL.

Manage to figure it out - Had to modify my apache2.conf with the following:-

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

Many thanks

Thanks for sharing the solution!