Remove "index.php" from URI

[details=“Support intro”]

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 30.3 beta (i think)
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian (Latest)
  • Web server and version (e.g, Apache 2.4.25):
    • Webmin (latest)
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • Cloudflare
  • PHP version (e.g, 8.3):
    • 8.2
  • Is this the first time you’ve seen this error? (Yes / No):
    • No
  • When did this problem seem to first start?
    • Since installation
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • PHP/MySQL Hosted on Webmin/Linux
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • Yes/Cloudflare

Htaccess:

SetEnvIfNoCase ^Authorization$ “(.+)” XAUTHORIZATION=$1

RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION

SetEnvIfNoCase Authorization “(.+)” HTTP_AUTHORIZATION=$1

SetEnvIfNoCase ^Authorization$ “(.+)” XAUTHORIZATION=$1

RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION

Security and privacy headers

Header always set Referrer-Policy “no-referrer”

Header always set X-Content-Type-Options “nosniff”

Header always set X-Frame-Options “SAMEORIGIN”

Header always set X-Permitted-Cross-Domain-Policies “none”

Header always set X-Robots-Tag “noindex, nofollow”

Header always set X-XSS-Protection “1; mode=block”

SetEnv modHeadersAvailable true

Cache control for static resources

<FilesMatch “.(css|js|mjs|svg|gif|png|jpg|webp|ico|wasm|tflite|otf|woff2?)$”>

<If “%{QUERY_STRING} =~ /(^|&)v=/”>

Header set Cache-Control “max-age=15778463, immutable”

<ElseIf “%{REQUEST_FILENAME} -match ‘.(otf|woff2?)$’”>

Header set Cache-Control “max-age=604800”

Header set Cache-Control “max-age=15778463”

php_value mbstring.func_overload 0

php_value default_charset ‘UTF-8’

php_value output_buffering 0

SetEnv htaccessWorking true

AddType image/svg+xml svg svgz

AddType application/wasm wasm

AddEncoding gzip svgz

AddType text/javascript js mjs

DirectoryIndex index.php index.html

ModPagespeed Off

RewriteEngine on

RewriteCond %{HTTP_USER_AGENT} DavClnt

RewriteRule ^$ /remote.php/webdav/ [L,R=302]

RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteRule ^.well-known/(carddav|caldav) /remote.php/dav/ [R=301,L]

RewriteRule ^remote/(.*) remote.php [QSA,L]

RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]

RewriteRule ^.well-known/(?!acme-challenge|pki-validation) /index.php [QSA,L]

RewriteRule ^ocm-provider/?$ index.php [QSA,L]

RewriteRule ^(?:.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]

RewriteCond %{REQUEST_FILENAME} !.(css|js|mjs|svg|gif|ico|jpg|jpeg|png|webp|html|otf|ttf|woff2?|map|webm|mp4|mp3|ogg|wav|flac|wasm|tflite)$

RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php

RewriteCond %{REQUEST_FILENAME} !/core/img/(favicon.ico|manifest.json)$

RewriteCond %{REQUEST_FILENAME} !/(cron|public|remote|status).php

RewriteCond %{REQUEST_FILENAME} !/ocs/v(1|2).php

RewriteCond %{REQUEST_FILENAME} !/robots.txt

RewriteCond %{REQUEST_FILENAME} !/(ocs-provider|updater)/

RewriteCond %{REQUEST_URI} !^/.well-known/(acme-challenge|pki-validation)/.*

RewriteCond %{REQUEST_FILENAME} !/richdocumentscode(_arm64)?/proxy.php$

RewriteRule . index.php [PT,E=PATH_INFO:$1]

RewriteBase /

SetEnv front_controller_active true

DirectorySlash off

SetEnvIfNoCase Transfer-Encoding “chunked” proxy-sendcl=1

SetEnv ap_trust_cgilike_cl

AddDefaultCharset utf-8

Options -Indexes

DO NOT CHANGE ANYTHING ABOVE THIS LINE

ErrorDocument 403 //index.php/error/403

ErrorDocument 404 //index.php/error/404

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|mjs|svg|gif|ico|jpg|jpeg|png|webp|html|otf|ttf|woff2?|map|webm|mp4|mp3|ogg|wav|flac|wasm|tflite)$

RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php

RewriteCond %{REQUEST_FILENAME} !/core/img/(favicon.ico|manifest.json)$

RewriteCond %{REQUEST_FILENAME} !/(cron|public|remote|status).php

RewriteCond %{REQUEST_FILENAME} !/ocs/v(1|2).php

RewriteCond %{REQUEST_FILENAME} !/robots.txt

RewriteCond %{REQUEST_FILENAME} !/(ocs-provider|updater)/

RewriteCond %{REQUEST_URI} !^/.well-known/(acme-challenge|pki-validation)/.*

RewriteCond %{REQUEST_FILENAME} !/richdocumentscode(_arm64)?/proxy.php$

RewriteRule . index.php [PT,E=PATH_INFO:$1]

RewriteBase /

SetEnv front_controller_active true

DirectorySlash off

and my config:

<?php $CONFIG = array ( 'instanceid' => 'xxxxxxxxxxxx', 'passwordsalt' => 'xxxxxxxxxxxx', 'secret' => 'xxxxxxxxxxxx', 'trusted_domains' => array ( 0 => '*.xxxxxxxxxxxx.org', ), 'datadirectory' => '/xxxxxxxxxxxx/xxxxxxxxxxxx/nextcloud/data', 'dbtype' => 'mysql', 'version' => '30.0.6.0', 'htaccess.RewriteBase' => '/', 'htaccess.IgnoreFrontController' => false, 'overwritehost' => 'cloud.xxxxxxxxxxxx.org', 'overwrite.cli.url' => 'https://cloud.xxxxxxxxxxxx.org/', 'overwriteprotocol' => 'https', 'dbname' => 'xxxxxxxxxxxx', 'dbhost' => 'xxxxxxxxxxxx:3306', 'dbport' => '', 'dbtableprefix' => 'xxx_', 'mysql.utf8mb4' => true, 'dbuser' => 'xxxxxxxxxxxx', 'dbpassword' => 'xxxxxxxxxxxx', 'installed' => true, 'mail_from_address' => 'xxxxxxxxxxxx', 'mail_smtpmode' => 'sendmail', 'mail_sendmailmode' => 'smtp', 'mail_domain' => 'xxxxxxxxxxxx.com', 'mail_smtpport' => '587', 'mail_smtphost' => 'xxxxxxxxxxxx-xxxxxxxxxxxx.xxxxxxxxxxxx.com', 'updater.release.channel' => 'beta', 'memories.db.triggers.fcu' => true, 'memories.exiftool' => '/xxxxxxxxxxxx/xxxxxxxxxxxx/nextcloud/apps/memories/bin-ext/exiftool-amd64-glibc', 'memories.vod.path' => '/xxxxxxxxxxxx/xxxxxxxxxxxx/nextcloud/apps/memories/bin-ext/go-vod-amd64', 'preview_ffmpeg_path' => '/usr/bin/ffmpeg', 'enabledPreviewProviders' => array ( 0 => 'OC\\Preview\\Image', 1 => 'OC\\Preview\\HEIC', 2 => 'OC\\Preview\\TIFF', 3 => 'OC\\Preview\\Movie', ), 'memories.vod.disable' => false, 'memories.vod.ffmpeg' => '/usr/bin/ffmpeg', 'memories.gis_type' => 1, 'app_install_overwrite' => array ( 0 => 'admin_notifications', 1 => 'webhooks', 2 => 'integration_ews', ), 'preview_max_x' => 2048, 'preview_max_y' => 2048, 'memories.vod.ffprobe' => '/usr/bin/ffprobe', 'maintenance' => false, 'maintenance_window_start' => 1, 'default_phone_region' => 'US', 'loglevel' => 0, 'theme' => '', );

Summary of the issue you are facing:

I need to remove the index.php from my URLs. I have already activated the Rewrite Engine in my .htaccess file, I added the ‘htaccess.RewriteBase’ => ‘/’, to my config… WHAT MORE CAN I DO TO GET THE “index.php” to go away!

You need the

occ maintenance:update:htaccess

command to activate it.

See Using the occ command — Nextcloud latest Administration Manual latest documentation

So sorry, I did run that we well. I forgot the mark that step on there. Still no change. Tried clearing the cookies and everything with no change.

Tried adding “‘htaccess.IgnoreFrontController’ => true,” which worked at changing the URL but then the site went down.