HowTo get rid of .../index.php/... in nextcloud path ( shorter URL)

Hi
I’m on a hosted server from Ionos

I think there is a way to get rid of e.g.

mymextcloud.x/index.php/apps/files/?dir=… in the path.

with htaccess and/or config.php

BUT!
I don’t know how! :unamused:

Hope for working exact REAL solution
Not one from looking into a fogged glass ball :face_with_monocle:

THX

2 Likes

When you’re using Apache put this at the bottom of your .htaccess file:

<IfModule mod_rewrite.c>
  Options -MultiViews
  RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]
  RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]
  RewriteCond %{REQUEST_FILENAME} !\.(css|js|svg|gif|png|html|ttf|woff2?|ico|jpg|jpeg|map|webm|mp4)$
  RewriteCond %{REQUEST_FILENAME} !core/img/favicon.ico$
  RewriteCond %{REQUEST_FILENAME} !core/img/manifest.json$
  RewriteCond %{REQUEST_FILENAME} !/remote.php
  RewriteCond %{REQUEST_FILENAME} !/public.php
  RewriteCond %{REQUEST_FILENAME} !/cron.php
  RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php
  RewriteCond %{REQUEST_FILENAME} !/status.php
  RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php
  RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php
  RewriteCond %{REQUEST_FILENAME} !/robots.txt
  RewriteCond %{REQUEST_FILENAME} !/updater/
  RewriteCond %{REQUEST_FILENAME} !/ocs-provider/
  RewriteCond %{REQUEST_FILENAME} !/ocm-provider/
  RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
  RewriteRule . index.php [PT,E=PATH_INFO:$1]
  RewriteBase /
  <IfModule mod_env.c>
    SetEnv front_controller_active true
    <IfModule mod_dir.c>
      DirectorySlash off
    </IfModule>
  </IfModule>
</IfModule>

Or follow the documentation and alter your .htaccess automatically with the occ command described here:
https://docs.nextcloud.com/server/18/admin_manual/installation/source_installation.html#pretty-urls

1 Like

THX for taking care
in my .htaccess I have now:

DO NOT CHANGE ANYTHING ABOVE THIS LINE

ErrorDocument 403 //
ErrorDocument 404 //

to use Https

RewriteEngine On
RewriteCond %{HTTP_HOST} !^cloud.domain.de$ [NC,OR]
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://cloud.domain.de/$1 [R=301,L]

remove Index.php in Path

Options -MultiViews RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1] RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1] RewriteCond %{REQUEST_FILENAME} !\.(css|js|svg|gif|png|html|ttf|woff2?|ico|jpg|jpeg|map|webm|mp4)$ RewriteCond %{REQUEST_FILENAME} !core/img/favicon.ico$ RewriteCond %{REQUEST_FILENAME} !core/img/manifest.json$ RewriteCond %{REQUEST_FILENAME} !/remote.php RewriteCond %{REQUEST_FILENAME} !/public.php RewriteCond %{REQUEST_FILENAME} !/cron.php RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php RewriteCond %{REQUEST_FILENAME} !/status.php RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php RewriteCond %{REQUEST_FILENAME} !/robots.txt RewriteCond %{REQUEST_FILENAME} !/updater/ RewriteCond %{REQUEST_FILENAME} !/ocs-provider/ RewriteCond %{REQUEST_FILENAME} !/ocm-provider/ RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.* RewriteRule . index.php [PT,E=PATH_INFO:$1] RewriteBase / SetEnv front_controller_active true DirectorySlash off

Ups I forgot how to insert Code in here I dont see it in my editor


Pls let me know.


BUT
Index.php still there in Path

04/2021
Any solution now?

Is there really nobody who can describe Ho-To achieve this?

Just for the record, I followed this and managed to set it up in five minutes. It works fine for me. If it doesn’t, it’s likely that you are missing some components e.g. the env or rewrite modules. I would double check the log to diagnose.

1 Like