https://cloud.koehn.com/index.php/core/js/oc.js also kicks me to the index page.
A shot in the dark, but since you mentioned php-fpm, did you read https://docs.nextcloud.org/server/9/admin_manual/installation/source_installation.html#php-fpm-configuration-notes
Yes. Many times. I do appreciate the suggestions tho.
I’m out of ideas… I’m just a guy who has learned to set up and sysadmin his own server starting from a month ago - I only learnt how to set up a LAMP stack last week.
Still, I appreciate the help. It looks like it’s the
index.php part that’s messing it all up. There’s some stuff in the
.htaccess that may be making it worse. I’m going to poke around and see what I can figure out. Thanks again!
No problem, glad to help where I can (or try to). that’s how communities grow!
OK, so here’s what I’ve found out. When requesting
https://cloud.koehn.com/core/js/oc.js, this is what’s sent to
php7.0-fpm (and works):
fcgi://127.0.0.1:9004/var/www/nextcloud/index.php (and it seems the
/core/js/oc.js is sent in the
https://cloud.koehn.com/index.php/core/js/oc.js (which is included in most pages in a
<script> tag), this is what’s sent to
php7.0-fpm (and does not work):
fcgi://127.0.0.1:9004/var/www/nextcloud/index.php/core/js/oc.js (and apparently there’s nothing in the
So it would appear that there’s a
RewriteRule somewhere that’s incorrect, or we need to change the URI that’s going out for things in
I did make sure that
AcceptPathInfo On is configured correctly.
I am on shared hosting without shell access. How can I enable “occ maintenance:update:htaccess” or add the rewrite rule manually to the .htaccess file? I have confirmed that mod_end and mod_rewrite are enabled on the server.
I already had some issues where the links with index.php became invalid and vice versa. I want both to be working since I already shared some files with the “index.php” in the url.
I tried just adding this to .htaccess but it does not work. I get an “The webpage cannot be found” error:
RewriteRule ^index.php/(.*) $1 [L]
Try with everything below that line from the post above with the full
#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####
I recently had a bugger of a time trying to get a variety of open source php projects running together on a new test server that I built where I was using php-fpm. I couldn’t work out why pages weren’t redirecting correctly.
As part of my diagnostic debug work I changed the Apache server config to use mod_php instead of php-fpm and lo and behold everything suddenly started working.
At this point I knew the problem was my php-fpm configuration.
Just putting in my 2 cents worth. Perhaps it might help to clearly identify the source of the problem.
This helped solve my problem: https://serverfault.com/questions/450628/apache-2-4-php-fpm-proxypassmatch
So I just upgraded to 10 without bringing across my htaccess file from the 9.0.52 installation and I noticed it’s already set and ready to go with the relevant rewritebase, presumably from the config file during the upgrade process.
Really pleased I didn’t have to potentially face the continuity issue again
Hi, I’m with nextcloud 10. fresh installation. installed nc10 on /nextcloud. mod_env and mod_rewrite already enabled,and followed steps below:
sudo vim /var/www/nextcloud/config/config.php
Add ‘htaccess.RewriteBase’ => ‘/nextcloud’,
sudo -u www-data php occ maintenance:update:htaccess
I still can’t get rid of index.php ,why?
Leo, you need to give
www-data write permission on .htaccess. I assume you’ve hardened your permissions, which would have revoked that permission. To fix it, ensure that
root owns the file and that
www-data is the group. Then run
sudo chmod 0664 .htaccess. Then run
occ again, and all will be fine.
I also have problem with removing index.php from address.
I do have correct permission on .htaccess, rewrite and env enabled
.there is no changes in .htaccess happening when running occ command…
out of ideas …
- I’m running NC 10.0.1 on a shared CENTOS server (installed in webroot of the subdomain, PHP 5.6.21)
- mod_rewrite and mod_env seem to be enabled.
- my .htaccess file looks pretty much exactly like the one FredFS456 posted further above.
- the permissions on the .htaccess file are 644 and the occ command updating .htaccess works.
- my config.php file features these options related to rewrites and htaccess:
‘overwrite.cli.url’ => ‘https://nextcloud.mydomain.com’,
‘overwriteprotocol’ => ‘https’,
‘htaccess.RewriteBase’ => ‘/’,
‘overwritewebroot’ => ‘/’,
‘overwritehost’ => ‘nextcloud.mydomain.com’,
‘has_internet_connection’ => true,
‘check_for_working_htaccess’ => true,
Still the index.php part of the URL is always present (in login URLs, sharing link URLs…).
Other than that, Nextcloud works without any noticable problems.
Any ideas what’s causing this?
OK, I think I may have found an answer. In an old owncloud admin manual for 9.x I found this:
My shared hosting company does not use mode_php but only fastcgi. So I guess unless NC supports fastcgi for index.php-less URLs in the future, this will remain a dream for me.
Any other options?
I’m also limited to CGI or fastCGI, but I really want to get rid of index.php in my URLs…
Or is there any official word when this feature is suspected to work with other php methods?
If you are using Apache you need to set the
AllowOverwrite attribute for the Nextcloud folder to
All - see https://docs.nextcloud.com/server/10/admin_manual/installation/source_installation.html#apache-web-server-configuration
This allows Apache to load the
.htaccess file and overwrite the settings from the apache config with the values in this file.
As a user in shared hosting environment I don’t think I have the permission to change/edit these settings.
But I think Apache already loads the .htacess in my Nextcloud folder because the contents of that .htaccess file does have an effect, with this one notable exception: no pretty URLs without index.php.