# Remove index.php in Url on Hosted Nextcloud

**URL:** <https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828>\
**Category:** 🗃️ Hosting providers\
**Tags:** ionos\
**Created:** [December 23, 2018, 11:06am UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828 "2018-12-23T11:06:33Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Witzker](https://help.nextcloud.com/user_avatar/help.nextcloud.com/witzker/32/36775_2.png) [@Witzker](https://help.nextcloud.com/u/Witzker)\
**Post date:** [December 23, 2018, 11:06am UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/1 "2018-12-23T11:06:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![shopmin](https://help.nextcloud.com/letter_avatar/shopmin/32/6_22734026db12803ebb3e059622ac3534.png) [@shopmin](https://help.nextcloud.com/u/shopmin)\
**Post date:** [December 23, 2018, 11:28am UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/2 "2018-12-23T11:28:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Witzker](https://help.nextcloud.com/user_avatar/help.nextcloud.com/witzker/32/36775_2.png) [@Witzker](https://help.nextcloud.com/u/Witzker)\
**Post date:** [December 23, 2018, 12:35pm UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/3 "2018-12-23T12:35:37Z")

</div>

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/apps/files/?dir=/Documents&fileid=13)  
[https://my.nextcloud.de/index.php/login](https://my.nextcloud.de/index.php/login)

in fact shorter url for [my.nextcloud.de](http://my.nextcloud.de)

---

<div class="post-metadata">

**Author:** ![shopmin](https://help.nextcloud.com/letter_avatar/shopmin/32/6_22734026db12803ebb3e059622ac3534.png) [@shopmin](https://help.nextcloud.com/u/shopmin)\
**Post date:** [December 23, 2018, 1:23pm UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/4 "2018-12-23T13:23:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Witzker](https://help.nextcloud.com/user_avatar/help.nextcloud.com/witzker/32/36775_2.png) [@Witzker](https://help.nextcloud.com/u/Witzker)\
**Post date:** [December 23, 2018, 2:03pm UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/5 "2018-12-23T14:03:29Z")

</div>

There are many descriptions out there but not for hosted installations

---

<div class="post-metadata">

**Author:** ![MichaIng](https://help.nextcloud.com/user_avatar/help.nextcloud.com/michaing/32/2125_2.png) [@MichaIng](https://help.nextcloud.com/u/MichaIng)\
**Post date:** [December 24, 2018, 4:51am UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/6 "2018-12-24T04:51:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Witzker](https://help.nextcloud.com/user_avatar/help.nextcloud.com/witzker/32/36775_2.png) [@Witzker](https://help.nextcloud.com/u/Witzker)\
**Post date:** [December 24, 2018, 11:26pm UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/7 "2018-12-24T23:26:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MichaIng](https://help.nextcloud.com/user_avatar/help.nextcloud.com/michaing/32/2125_2.png) [@MichaIng](https://help.nextcloud.com/u/MichaIng)\
**Post date:** [December 24, 2018, 11:42pm UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/8 "2018-12-24T23:42:20Z")

</div>

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 😃🎄

---

<div class="post-metadata">

**Author:** ![Witzker](https://help.nextcloud.com/user_avatar/help.nextcloud.com/witzker/32/36775_2.png) [@Witzker](https://help.nextcloud.com/u/Witzker)\
**Post date:** [December 25, 2018, 12:19am UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/9 "2018-12-25T00:19:28Z")

</div>

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/apps/files/?dir=/Documents&fileid=13)  
[https://my.nextcloud.de/index.php/login](https://my.nextcloud.de/index.php/login)

in fact shorter url for [my.nextcloud.de](http://my.nextcloud.de/)

---

<div class="post-metadata">

**Author:** ![GunnarO](https://help.nextcloud.com/letter_avatar/gunnaro/32/6_22734026db12803ebb3e059622ac3534.png) [@GunnarO](https://help.nextcloud.com/u/GunnarO)\
**Post date:** [April 4, 2020, 10:02am UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/10 "2020-04-04T10:02:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Witzker](https://help.nextcloud.com/user_avatar/help.nextcloud.com/witzker/32/36775_2.png) [@Witzker](https://help.nextcloud.com/u/Witzker)\
**Post date:** [April 5, 2020, 9:28pm UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/11 "2020-04-05T21:28:24Z")

</div>

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

PLS Where to put What?

> [@Witzker](#):
>
> 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 //

PLS next step  
Hope for help!

---

<div class="post-metadata">

**Author:** ![GunnarO](https://help.nextcloud.com/letter_avatar/gunnaro/32/6_22734026db12803ebb3e059622ac3534.png) [@GunnarO](https://help.nextcloud.com/u/GunnarO)\
**Post date:** [April 10, 2020, 7:05pm UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/12 "2020-04-10T19:05:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JanarNext](https://help.nextcloud.com/user_avatar/help.nextcloud.com/janarnext/32/31480_2.png) [@JanarNext](https://help.nextcloud.com/u/JanarNext)\
**Post date:** [March 16, 2021, 11:43am UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/13 "2021-03-16T11:43:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![3x5](https://help.nextcloud.com/user_avatar/help.nextcloud.com/3x5/32/14532_2.png) [@3x5](https://help.nextcloud.com/u/3x5)\
**Post date:** [April 6, 2023, 2:51pm UTC](https://help.nextcloud.com/t/remove-index-php-in-url-on-hosted-nextcloud/43828/14 "2023-04-06T14:51:03Z")

</div>

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.
