Remove "index.php" from the URL on a hosted web space without console access

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 (eg, 20.0.5): 23.0.0
Operating system and version (eg, Ubuntu 20.04): I don’t know because I rent it. It is a webspace
Apache or nginx version (eg, Apache 2.4.25): I don’t know, I’m new to Nextcloud
PHP version (eg, 7.4): 7.4.26

The issue you are facing:

I have set up a new Nextcloud instance and want to remove the “index.php” from my URL.
Unfortunately, I am very limited: I rented a web space without access to the console.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Set up a fresh Nextcloud instance xD

The output of your Nextcloud log in Admin > Logging:

Is not necessary, I think

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'XXXXXXXXX',
  'passwordsalt' => 'XXXXXXXXX',
  'secret' => 'XXXXXXXXX',
  'trusted_domains' => 
  array (
    0 => 'XXXXXXXXX',
  ),
  'datadirectory' => 'XXXXXXXXX',
  'dbtype' => 'mysql',
  'version' => '23.0.0.10',
  'overwrite.cli.url' => 'XXXXXXXXX',
  'dbname' => 'XXXXXXXXX',
  'dbhost' => 'XXXXXXXXX',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'XXXXXXXXX',
  'dbpassword' => 'XXXXXXXXX',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'XXXXXXXXX',
  'mail_domain' => 'XXXXXXXXX',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => 'XXXXXXXXX',
  'mail_smtpport' => 'XXXXXXXXX',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'XXXXXXXXX',
  'mail_smtppassword' => 'XXXXXXXXX',
  'simpleSignUpLink.shown' => false,
);

The output of your Apache/nginx/system log in /var/log/____:

I cant find the path or I dont have access to it. :(

You just need to add to config.php

'htaccess.RewriteBase' => '/',

and execute afterwards:

occ maintenance:update:htaccess

How to use the occ- command: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html

How to run the occ command in a web terminal: https://apps.nextcloud.com/apps/occweb

Thanks, I added this to the config .php. Unfortunately, I use Nextcloud version 23, and can’t use the app. I also can’t access the terminal of the webspace. Is there another way to execute the command?

Thanks :slight_smile:

Hi @XHyperDEV

I’m afraid not. You could try to “force” install the app. But I wouldn’t recommend that. Instead of that I highly recommend migrating to a webspace where they at least give you command line access in the context of the user of the web server, so you can execute occ commands. Better would be a VPS where you have full root access and can do a manual install or using something like Docker, Snap etc…

Despite what still too many say, a simple webspace is not suitable anymore for running complex applications like Nexcloud. And we are only talking about a cosmetic setting here, imgaine one day you have a real problem with your Nextcloud, which can only be solved via OCC command… :wink:

1 Like

Is there a chance you can set up a cronjob on your webspace? Could be a workaround to set a cronjob to the occ command, let it run and disable the cronjob again…

Yes there is. For example: http://web-console.org/

Okay, I was able to install it. What do I have to enter there now?

The occ command. After editing config.php of course.

Okay, if I type
occ maintenance:update:htaccess,
it says
sh: 1: occ: not found.
Why is that?

Because you did not read the explanation of the occ command as mentioned in the link above.

When I type
sudo -u www-data php occ
as described from the link above, it comes:
Screenshot 2021-12-19 164514

The web terminal is already runnig as user www-data, therefore a simple “php occ …” should be enough i think.

okay thanks, now it goes. It says I need to use PHP V7.3 but I use V7.0. Can I just upgrade this or could it break my Nextcloud?

I am confused a little bit?

Oh, in the console comes this:
Screenshot 2021-12-19 172133

But in Plesk it says:

Propably you can assign different versions of PHP to your virtual hosts on Plesk?

You can test with phpinfo() as well.

Where can I enter phpinfo()?
It doesn’t work in the web console!

I don’t know where I could have chosen different PHP versions.

You need to create a php file, e.g. “phpinfo.php”

<?php
    phpinfo();
?>

and open it on your webserver.

I’m sure your provider can advise you.

I am still waiting for the answer from my provider. I created and executed the phpinfo file. A lot of text came out, what exactly do I have to look for?

You can show it to your provider and ask how to setup the correct PHP version for your Nextcloud installation.