Internal server error after implementing "Pretty URLS"

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (18.03):
Operating system and version (Ubuntu 18.04.4. LTS):
Apache or nginx version (Apache 2.4.29):
PHP version (7.2.24):

The issue you are facing:

I see the message " Internal Server Error The server was unable to complete your request. If this happens again, please send the technical details below to the server administrator. More details can be found in the server log." When trying to access Nextcloud. It used to work perfectly fine recently. The last thing that I was doing is trying to implement “Pretty URLs” part of installation manual.

It started working at first, but next time when I tried to launc Nextcloud I see mentioned error.

Also I can’t actually find .htaccess file anywhere in nextcloud directory.

If I remove this lines from config.php ```
‘htaccess.RewriteBase’ => ‘/nextcloud’,


Any help is much appreciated!


Is this the first time you've seen this error? _(Y)_:

Steps to replicate it:

1. Add next two lines to `config.php` 
    'overwrite.cli.url' => 'https://example.org/nextcloud',
    'htaccess.RewriteBase' => '/nextcloud',
2. Run this commmand:
`sudo -u www-data php /var/www/html/nextcloud/occ maintenance:update:htaccess`
3. 

The output of your Nextcloud log in **Admin > Logging**:

{“reqId”:“CCoNzROPt5besg1eSwkF”,“level”:3,“time”:“2020-03-30T20:10:19+00:00”,“remoteAddr”:“127.0.0.1”,“user”:"–",“app”:“index”,“method”:“GET”,“url”:"/login",“message”:{“Exception”:“Exception”,“Message”:“The requested uri(/login) cannot be processed by the script ‘/nextcloud/index.php’)”,“Code”:0,“Trace”:[{“file”:"/var/www/html/nextcloud/lib/base.php",“line”:951,“function”:“getRawPathInfo”,“class”:“OC\AppFramework\Http\Request”,“type”:"->",“args”:[]},{“file”:"/var/www/html/nextcloud/index.php",“line”:38,“function”:“handleRequest”,“class”:“OC”,“type”:"::",“args”:[]}],“File”:"/var/www/html/nextcloud/lib/private/AppFramework/Http/Request.php",“Line”:782,“CustomMessage”:"–"},“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0”,“version”:“18.0.3.0”}


The output of your config.php file in `/path/to/nextcloud` (make sure you remove any identifiable information!):
<?php $CONFIG = array ( 'instanceid' => '', 'passwordsalt' => '', 'secret' => '', 'trusted_domains' => array ( 0 => '192.168.1.119', 1 => mydomain.com', ), 'datadirectory' => '/var/www/html/nextcloud/data', 'dbtype' => 'mysql', 'version' => '18.0.3.0', 'overwrite.cli.url' => 'https://mydomain.com/nextcloud', 'htaccess.RewriteBase' => '/nextcloud', 'dbname' => 'next_db', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'dbuser' => 'ncuser', 'dbpassword' => '', 'installed' => true, 'mysql.utf8mb4' => true, 'maintenance' => false, ); ```

There is an “occ” option to generate your .htaccess file.

If I’m reading your log excerpts correctly, this should do it for you, assuming you haven’t changed the default Ubuntu web server user (www-data):

sudo -u www-data php /var/www/html/nextcloud/occ maintenance:update:htaccess

[edit]
This is slightly different from the command shown in the installation manual since your nextcloud appears to be at /var/www/html/nextcloud while the manual assumes it’s at /var/www/nextcloud

I actually did it with added /html/ so this won’t help, but thanks.