Remove index.php in Url on Hosted Nextcloud

Hallo,

I have my nextcloud in a subdomain on an 1&1 Webspace folder.

Now I try to configure everything in proper way.

As I canot send Instructions to the 1und1 server so Im looking for a way to remove /index.php/ in the Nextcloud URL

Please tel me what to put where to solve this

1 Like

when creating a new domain / subdomain, an index.php is usually created automatically, which contains e.g. “here will be soon…” or something similar.
Before (!) Nextcloud is installed, this file must be removed. When Nextcloud is installed, a new index.php is created automatically.
This contains the following for me (NC 14.04):

<?php
/**
 *
 * Your webserver seems to be not configured to use PHP or PHP is not installed. 
 * Please contact your administrator or follow our documentation: 
 * https://docs.nextcloud.com/server/13/admin_manual/installation/source_installation.html 
 *
 * @copyright Copyright (c) 2016, ownCloud, Inc.
 *
 * @author Georg Ehrke <oc.list@georgehrke.com>
 * @author Joas Schilling <coding@schilljs.com>
 * @author JĂśrn Friedrich Dreyer <jfd@butonic.de>
 * @author Lukas Reschke <lukas@statuscode.ch>
 * @author Morris Jobke <hey@morrisjobke.de>
 * @author Robin Appelman <robin@icewind.nl>
 * @author Sergio BertolĂ­n <sbertolin@solidgear.es>
 * @author Thomas MĂźller <thomas.mueller@tmit.eu>
 * @author Vincent Petry <pvince81@owncloud.com>
 *
 * @license AGPL-3.0
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */

require_once __DIR__ . '/lib/versioncheck.php';

try {

	require_once __DIR__ . '/lib/base.php';

	OC::handleRequest();

} catch(\OC\ServiceUnavailableException $ex) {
	\OC::$server->getLogger()->logException($ex, array('app' => 'index'));

	//show the user a detailed error page
	OC_Template::printExceptionErrorPage($ex, 503);
} catch (\OC\HintException $ex) {
	try {
		OC_Template::printErrorPage($ex->getMessage(), $ex->getHint(), 503);
	} catch (Exception $ex2) {
		try {
			\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
			\OC::$server->getLogger()->logException($ex2, array('app' => 'index'));
		} catch (Throwable $e) {
			// no way to log it properly - but to avoid a white page of death we try harder and ignore this one here
		}

		//show the user a detailed error page
		OC_Template::printExceptionErrorPage($ex, 500);
	}
} catch (\OC\User\LoginException $ex) {
	OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 403);
} catch (Exception $ex) {
	\OC::$server->getLogger()->logException($ex, array('app' => 'index'));

	//show the user a detailed error page
	OC_Template::printExceptionErrorPage($ex, 500);
} catch (Error $ex) {
	try {
		\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
	} catch (Error $e) {
		http_response_code(500);
		header('Content-Type: text/plain; charset=utf-8');
		print("Internal Server Error\n\n");
		print("The server encountered an internal error and was unable to complete your request.\n");
		print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n");
		print("More details can be found in the webserver log.\n");

		throw $e;
	}
	OC_Template::printExceptionErrorPage($ex, 500);
}

If that wasn’t your question, please describe your problem in more detail.
Wenn das nicht deine Frage war, schildere dein Problem bitte etwas genauer.

Im looking for a way to remove /index.php/ in the Nextcloud URL
eg
https://my.nextcloud.de/INDEX.PHP/apps/files/?dir=/Documents&fileid=13
https://my.nextcloud.de/index.php/login

in fact shorter url for my.nextcloud.de

Oh, apparently a directory named “index.php” was created (for whatever reason) and the Nextcloud installation was done in it.
You can either redirect your domain to this directory (I don’t know how to do this with 1&1) or delete your installation and run it again in the root directory of your domain.

Ask the support of 1&1 about the domain redirection.

UPDATE:
P.S. I just looked again: this is completely normal!
I don’t know now how you could change that.

There are many descriptions out there but not for hosted installations

Which webserver is in use?

I only know a way to enable this on Apache via .htaccess: https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#pretty-urls

  • Okay the occ command requires terminal access again, but one can manually add the resulting rewrite rules manually as well. Will check out tomorrow.

On Nginx AFAIK or can only be enabled via direct webserver config.

THX for taking care
Now I have in htaccess:

DO NOT CHANGE ANYTHING ABOVE THIS LINE

#-
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#-

Header set Strict-Transport-Security “max-age=31536000; includeSubDomains; preload” env=HTTPS

ErrorDocument 403 //
ErrorDocument 404 //

Jep that is what should work on Apache webserver, but other webserver do not read .htaccess files.

Note that with preload option your domain might get added to the list, so you will not be able to access it without https anymore. This is generally fine, but I think everyone should know, since I see this in so many guides without further explanation.

Happy Christmas holidays btw to all :smiley::christmas_tree:

yes
I added this lines to have https without this it was http
so the server is reading the htaccess - which is good
but there is still index.php in the url!

Im looking for a way to remove /index.php/ in the Nextcloud URL
eg
https://my.nextcloud.de/INDEX.PHP/apps/files/?dir=/Documents&fileid=13
https://my.nextcloud.de/index.php/login

in fact shorter url for my.nextcloud.de

I searched for the same. the most answers wasn’t helpful in this point.

By tryout i checked, that the load without the /index.php/ part works.

i found my solution in the config.sample.php

’htaccess.IgnoreFrontController’ => false,

i added the line in my config and changed it to true.

It works like charme, doesn’t through any errors.
I still have to check the apps etc. but it’s promising.

3 Likes

OK THX
But PLS be patient with me as absolute beginner who tries to learn

PLS Where to put What?

PLS next step
Hope for help!

just write this line : ’htaccess.IgnoreFrontController’ => false,

in your config.php (in config folder below your nextcloud installation) before the closing bracket (last line)

it will hides the index.php at generating. If the server isn’t set up properly you will get an error, but since there are rewrite rules allready there, just give it a shot.

Thanks, it worked for me. Just make sure to restart apache after you add this line.

This seems to be a popular solution, but it doesn’t work for me. When I add this line, the paths to all my assets (images, stylesheets) stop working, and removing index.php from the URL just gives me an open directory. So for instance, /apps/dashboard/ just shows me the subdirectories of that folder.

Am I missing some index.php files? I have upgraded to the latest instance of Nextcloud, incrementally, from a very old version—so maybe there’s something missing in my install, I don’t know.