Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL rewrite to lose index.php with Apache & fastcgi ? #5576

Closed
ghost opened this issue Jun 30, 2017 · 4 comments
Closed

URL rewrite to lose index.php with Apache & fastcgi ? #5576

ghost opened this issue Jun 30, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Jun 30, 2017

Steps to reproduce

  1. Open any Nextcloud page
  2. URL contains index.php

Desired behaviour

URL does not contain index.php (=shorter URL)

Server configuration

Operating system: CENTOS
Web server: Apache
Database: mySQL
PHP version: 7
Nextcloud version: 12

I know it's possible to have NC rewrite URLs so they don't end in index.php. Makes the URL prettier but most importantly shorter.

I can fiddle with config.php all I want but it was my understanding that the restriction was beyond simple user control.

Is it possible to do that in a shared hosting environment (with Apache & fastcgi/mod_fastcgi) where users don't have permission to edit the server config? Or is it still restricted to Apache and mod_php?

If so, would you please consider expanding support to the Apache + fastcgi/mod_fastcgi combi (for restricted users with no root access)?


EDIT:

Contents of config.php:

<?php
$CONFIG = array (
  'instanceid' => 'ocXXXXXXXXX',
  'passwordsalt' => 'XXXXXXXXXXXXXXXX',
  'hashingCost' => 10,
  'trusted_domains' =>
  array (
	0 => 'subdomain.mydomain.com',
  ),
  'datadirectory' => '/where/the/data/lives',
  'version' => '12.0.0.29',
  'dbtype' => 'mysql',
  'dbname' => 'myuser_owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'myuser',
  'dbpassword' => 'SOMEPW',
  'installed' => true,
  'default_language' => 'en',
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
	'host' => '/home/myuser/.redis/sock',
	'port' => 0,
	'timeout' => 0,
  ),
  'overwrite.cli.url' => 'https://subdomain.mydomain.com',
  'overwriteprotocol' => 'https',
  'htaccess.RewriteBase' => '/',
  'overwritewebroot' => '/',
  'overwritehost' => 'subdomain.mydomain.com',
  'auth.bruteforce.protection.enabled' => true,
  'updatechecker' => true,
  'has_internet_connection' => true,
  'check_for_working_webdav' => true,
  'check_for_working_htaccess' => true,
  'log_type' => 'owncloud',
  'loglevel' => 0,
  'logdateformat' => 'Y-m-d H:i:s',
  'logtimezone' => 'Europe/London',
  'log_rotate_size' => 10485760,
  'log_authfailip' => true,
  'enable_previews' => true,
  'preview_max_scale_factor' => 1,
  'enabledPreviewProviders' =>
  array (
	0 => 'OC\\Preview\\PNG',
	1 => 'OC\\Preview\\JPEG',
	2 => 'OC\\Preview\\GIF',
	3 => 'OC\\Preview\\BMP',
	4 => 'OC\\Preview\\XBitmap',
	5 => 'OC\\Preview\\MP3',
	6 => 'OC\\Preview\\TXT',
	7 => 'OC\\Preview\\MarkDown',
  ),
  'maintenance' => false,
  'theme' => '',
  'cipher' => 'AES-256-CFB',
  'secret' => 'LONGSTRING',
  'blacklisted_files' =>
  array (
	0 => '.htaccess',
  ),
  'asset-pipeline.enabled' => false,
  'updater.release.channel' => 'stable',
);

Thank you.

@dirigit
Copy link

dirigit commented Jul 2, 2017

Use .htaccess for this.

It will fail integrity check afterwards but, maybe they exclude it from check at some time (it's really annoying).

@MorrisJobke
Copy link
Member

Just set 'htaccess.RewriteBase' => '/server/', (or wherever you have installed your Nextcloud) to the config.php and execute occ maintenance:update:htaccess and you should get a proper htaccess file and URLs without index.php.

For more help ask in the forums: https://help.nextcloud.com/

@ghost
Copy link
Author

ghost commented Jul 20, 2017

@MorrisJobke
Isn't it a bit premature to close this? Before starting this thread here I did search help.nextcloud.com, and there are several threads by different people concerning the removal of index.php from the URL, hinting at a problem with Apache and fastcgi (which I checked is true in my case as well).
The remedy you suggested was mentioned there somewhere. I've tried that before and just now, without any effect on the URL.

Just to be on the safe side, I've edited the first post to include the contents of my config.php. My Nextcloud resides in the webroot of a subdomain BTW.

@MorrisJobke
Copy link
Member

Just to be on the safe side, I've edited the first post to include the contents of my config.php. My Nextcloud resides in the webroot of a subdomain BTW.

Usually this is all that is needed:

  • update the htaccess.RewriteBase
  • call occ maintenance:update:htaccess (and have an .htaccess file that is writable by the web server user of course)

The only thing that comes to my mind is: Is the .htaccess even used in your environment? The apache config needs to set the AllowOverride All config option for your web root. If this is not set there is not much we can do.

I closed this ticket because this is working for a lot of instances and really looks like a setup/environment problem than a real bug. If the web host doesn't support the htaccess file, we can't do much. And the bug tracker here is for bugs. If you need help with the environment and setup then the forum is the better place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants