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

9.0.3: New way to index.php-less URLs #2431

Closed
ghost opened this Issue May 20, 2016 · 22 comments

Comments

Projects
None yet
5 participants
@ghost

ghost commented May 20, 2016

This makes this explicitly an opt-in configuration flag. If htaccess.RewriteBase is set then it will configure index.php-less URLs, if admins set that after installation and don't want to wait until the next ownCloud version they can run occ maintenance:update:htaccess.

oC Version: 9.0.3
Resf: owncloud/core#24539, owncloud/core#24540

@carlaschroder carlaschroder self-assigned this May 26, 2016

@carlaschroder carlaschroder added this to the 9.0.3-current-maintenance milestone May 26, 2016

@carlaschroder

This comment has been minimized.

Show comment
Hide comment
@carlaschroder

carlaschroder May 26, 2016

Contributor

GAH. I sure do miss the days of simple static HTML pages, and all you had to do to be a good web dev was avoid using blink tags.

Contributor

carlaschroder commented May 26, 2016

GAH. I sure do miss the days of simple static HTML pages, and all you had to do to be a good web dev was avoid using blink tags.

@carlaschroder

This comment has been minimized.

Show comment
Hide comment
@carlaschroder

carlaschroder May 26, 2016

Contributor

@RealRancor Can you help? I'm having a hard time wrapping my mind around this. Is this about configuring the ownCloud server URL to https://mysite instead of https://mysite/owncloud? I have read owncloud/core#24539, owncloud/core#24525, and owncloud/core#24426, and still struggling.

Contributor

carlaschroder commented May 26, 2016

@RealRancor Can you help? I'm having a hard time wrapping my mind around this. Is this about configuring the ownCloud server URL to https://mysite instead of https://mysite/owncloud? I have read owncloud/core#24539, owncloud/core#24525, and owncloud/core#24426, and still struggling.

@carlaschroder

This comment has been minimized.

Show comment
Hide comment
@carlaschroder
Contributor

carlaschroder commented May 26, 2016

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost May 26, 2016

@carlaschroder Not that familiar with that stuff but from what know:

oC 9.0.0 - 9.0.2 enabled the index-less URLs (e.g. https://demo.owncloud.org/apps/files/ instead of https://demo.owncloud.org/index.php/apps/files/) automatically if mod_rewrite and mod_env was enabled according to owncloud/core#14081 . Those versions took the value of overwrite.cli.url from the config.php and configured the RewriteBase accordingly. Those approach has shown an issue as people havn't configured overwrite.cli.url correctly which had caused a wrong configured RewriteBase

With oC 9.0.3+ this is now not done automatically anymore. The prerequisite of an enabled mod_rewrite and mod_env is still there but the admin needs to do some additional steps:

Configure htaccess.RewriteBase in the config.php correctly. This means if the oC installation is reachable via https://mysite the htaccess.RewriteBase needs to be / where a oC installation reachable via https://mysite/owncloud the htaccess.RewriteBase needs to be /owncloud

Afterwards the admin can wait for the next oC update (e.g. 9.0.4) or run the occ maintenance:update:htaccess command.

Hope i got everything right.

cc @LukasReschke Mind have a look?

ghost commented May 26, 2016

@carlaschroder Not that familiar with that stuff but from what know:

oC 9.0.0 - 9.0.2 enabled the index-less URLs (e.g. https://demo.owncloud.org/apps/files/ instead of https://demo.owncloud.org/index.php/apps/files/) automatically if mod_rewrite and mod_env was enabled according to owncloud/core#14081 . Those versions took the value of overwrite.cli.url from the config.php and configured the RewriteBase accordingly. Those approach has shown an issue as people havn't configured overwrite.cli.url correctly which had caused a wrong configured RewriteBase

With oC 9.0.3+ this is now not done automatically anymore. The prerequisite of an enabled mod_rewrite and mod_env is still there but the admin needs to do some additional steps:

Configure htaccess.RewriteBase in the config.php correctly. This means if the oC installation is reachable via https://mysite the htaccess.RewriteBase needs to be / where a oC installation reachable via https://mysite/owncloud the htaccess.RewriteBase needs to be /owncloud

Afterwards the admin can wait for the next oC update (e.g. 9.0.4) or run the occ maintenance:update:htaccess command.

Hope i got everything right.

cc @LukasReschke Mind have a look?

@carlaschroder

This comment has been minimized.

Show comment
Hide comment
@carlaschroder

carlaschroder May 31, 2016

Contributor

ok I think I get it. Thanks @RealRancor

Contributor

carlaschroder commented May 31, 2016

ok I think I get it. Thanks @RealRancor

@cdamken

This comment has been minimized.

Show comment
Hide comment
@cdamken

cdamken Jun 16, 2016

Contributor

The rewrite happens in 9.0.2 too

Contributor

cdamken commented Jun 16, 2016

The rewrite happens in 9.0.2 too

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jun 16, 2016

@cdamken Yes, but automatically if mod_rewrite and mod_env was available. With oC 9.0.3 an admin needs to explicitly enable this as written above.

ghost commented Jun 16, 2016

@cdamken Yes, but automatically if mod_rewrite and mod_env was available. With oC 9.0.3 an admin needs to explicitly enable this as written above.

@cdamken

This comment has been minimized.

Show comment
Hide comment
@cdamken

cdamken Jun 16, 2016

Contributor

@RealRancor that is correct 😄

Contributor

cdamken commented Jun 16, 2016

@RealRancor that is correct 😄

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Jun 28, 2016

Member

Ok, I have been experimenting because I haven't found any proper instructions.

On 9.0.2:

  1. Make sure .htaccess works (Apache config)
  2. Make sure .htaccess is writable for the web server
  3. Setup ownCloud from scratch using the web U
  4. See that "index.php" is in the URL (redirected from setup)
  5. Change browser's URL and remove "index.php" => ownCloud still works
  6. Log out, log in
  7. Short URL sticks

Upgrade to 9.0.3RC1:

  1. Pick a workaround 9.0.2 instance from #2205 (comment)
  2. Move the folder to another location
  3. Extract 9.0.3RC1 tarball
  4. Adjust permissions, also set write permissions to .htaccess (the new one)
  5. Copy "data" and "config" from the old 9.0.2 folder (I used cp -Rva ../owncloudtest.old/{config,data} . with "a" to make sure permissions are kept)
  6. Run occ upgrade
  7. Login to ownCloud again
  8. Short URL sticks!

This means that even if .htaccess is replaced, after an upgrade it will be readjusted. @jnweiger

Update to 9.1.0beta2, same result. Still works.

Member

PVince81 commented Jun 28, 2016

Ok, I have been experimenting because I haven't found any proper instructions.

On 9.0.2:

  1. Make sure .htaccess works (Apache config)
  2. Make sure .htaccess is writable for the web server
  3. Setup ownCloud from scratch using the web U
  4. See that "index.php" is in the URL (redirected from setup)
  5. Change browser's URL and remove "index.php" => ownCloud still works
  6. Log out, log in
  7. Short URL sticks

Upgrade to 9.0.3RC1:

  1. Pick a workaround 9.0.2 instance from #2205 (comment)
  2. Move the folder to another location
  3. Extract 9.0.3RC1 tarball
  4. Adjust permissions, also set write permissions to .htaccess (the new one)
  5. Copy "data" and "config" from the old 9.0.2 folder (I used cp -Rva ../owncloudtest.old/{config,data} . with "a" to make sure permissions are kept)
  6. Run occ upgrade
  7. Login to ownCloud again
  8. Short URL sticks!

This means that even if .htaccess is replaced, after an upgrade it will be readjusted. @jnweiger

Update to 9.1.0beta2, same result. Still works.

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Jun 28, 2016

Member

Setting up 9.0.3RC1 or 9.1.0beta2 from scratch does NOT work even with writable .htaccess. And once it didn't work, upgrading also doesn't auto-adjust .htaccess. Not sure what is going on here...

There was that bit about "front_controller_active" maybe.

But then why did it work when I updated ? A hidden setting somewhere ?

Member

PVince81 commented Jun 28, 2016

Setting up 9.0.3RC1 or 9.1.0beta2 from scratch does NOT work even with writable .htaccess. And once it didn't work, upgrading also doesn't auto-adjust .htaccess. Not sure what is going on here...

There was that bit about "front_controller_active" maybe.

But then why did it work when I updated ? A hidden setting somewhere ?

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Jun 28, 2016

Member

Ok, seems #2431 (comment) might be it.

Will try later.

Member

PVince81 commented Jun 28, 2016

Ok, seems #2431 (comment) might be it.

Will try later.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jun 28, 2016

@PVince81 oC 9.0.3+ won't automatically enable index.php-less URLs as stated in: #2431 (comment)

You need to configure htaccess.RewriteBase in your config.php and do either the update/upgrade to the next version or run occ maintenance:update:htaccess

ghost commented Jun 28, 2016

@PVince81 oC 9.0.3+ won't automatically enable index.php-less URLs as stated in: #2431 (comment)

You need to configure htaccess.RewriteBase in your config.php and do either the update/upgrade to the next version or run occ maintenance:update:htaccess

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Jun 28, 2016

Member

@RealRancor the strange thing is that on my private server I upgraded from 9.0.2 to 9.1.0beta2 and 9.1 lost the ability. But from my tests above 9.0.3RC1 to 9.1.0beta2 worked.
So maybe we need a repair step or migration step for people with packages.
As for the automatic updater an update from 9.0.2 to 9.0.3 will be forced first anyway.

CC @jnweiger @SergioBertolinSG for the above infos

Member

PVince81 commented Jun 28, 2016

@RealRancor the strange thing is that on my private server I upgraded from 9.0.2 to 9.1.0beta2 and 9.1 lost the ability. But from my tests above 9.0.3RC1 to 9.1.0beta2 worked.
So maybe we need a repair step or migration step for people with packages.
As for the automatic updater an update from 9.0.2 to 9.0.3 will be forced first anyway.

CC @jnweiger @SergioBertolinSG for the above infos

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Jun 29, 2016

Member

This is what I observed:

  • in OC < 9.0.3: need to make .htaccess writable then setup/upgrade: this will make index.php-less work
  • in OC >= 9.0.3: need config.php option "htaccess.RewriteBase" to be set and writable .htaccess, run upgrade and it will work
  • upgrading from OC < 9.0.3 to OC >= 9.0.3 automatically generates "htaccess.RewriteBase". However, need to make sure that .htaccess is still writable for the setting to trigger .htaccess adjustment.

Setting the value "htaccess.RewriteBase" in config.php is not enough to trigger the adjustment. One needs to run the upgrade routine for the adjustment of .htaccess to take place

On my 9.1.0beta2 server I found out that the config.php setting was there, but .htaccess wasn't writable. After making it writable I used version.php trickery to be able to run occ upgrade and make the auto-adjustment do its work.

Member

PVince81 commented Jun 29, 2016

This is what I observed:

  • in OC < 9.0.3: need to make .htaccess writable then setup/upgrade: this will make index.php-less work
  • in OC >= 9.0.3: need config.php option "htaccess.RewriteBase" to be set and writable .htaccess, run upgrade and it will work
  • upgrading from OC < 9.0.3 to OC >= 9.0.3 automatically generates "htaccess.RewriteBase". However, need to make sure that .htaccess is still writable for the setting to trigger .htaccess adjustment.

Setting the value "htaccess.RewriteBase" in config.php is not enough to trigger the adjustment. One needs to run the upgrade routine for the adjustment of .htaccess to take place

On my 9.1.0beta2 server I found out that the config.php setting was there, but .htaccess wasn't writable. After making it writable I used version.php trickery to be able to run occ upgrade and make the auto-adjustment do its work.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jun 29, 2016

Don't forget the occ maintenance:update:htaccess in oC 9.0.3+

ghost commented Jun 29, 2016

Don't forget the occ maintenance:update:htaccess in oC 9.0.3+

@MorrisJobke

This comment has been minimized.

Show comment
Hide comment
@MorrisJobke

MorrisJobke Jun 29, 2016

Member

Yes. This was added with owncloud/core#24539.

Member

MorrisJobke commented Jun 29, 2016

Yes. This was added with owncloud/core#24539.

@cdamken

This comment has been minimized.

Show comment
Hide comment
@cdamken
Contributor

cdamken commented Jun 29, 2016

@childnode

This comment has been minimized.

Show comment
Hide comment
@childnode

childnode Jun 30, 2016

seriously ... we should allow "untrusted" web application code to manipulate the htaccess file?!
Sound like a no-go ...

is there a way to get the htaccess content printed or as diff / patch as an alternative?!

childnode commented Jun 30, 2016

seriously ... we should allow "untrusted" web application code to manipulate the htaccess file?!
Sound like a no-go ...

is there a way to get the htaccess content printed or as diff / patch as an alternative?!

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jun 30, 2016

@childnode Just don't use this feature if you're worry about the security. Discussing further possibilities / implementations like the mentioned alternative is out of the scope of this issue here. If you would like to see something like this please create a new issue at https://github.com/owncloud/core/issues

ghost commented Jun 30, 2016

@childnode Just don't use this feature if you're worry about the security. Discussing further possibilities / implementations like the mentioned alternative is out of the scope of this issue here. If you would like to see something like this please create a new issue at https://github.com/owncloud/core/issues

@cdamken

This comment has been minimized.

Show comment
Hide comment
@cdamken

cdamken Jul 28, 2016

Contributor

Some more infos:

https://central.owncloud.org/t/the-requested-uri-login-cannot-be-processed-by-the-script-owncloud-index-php/993

Sorry, you don't have access to that topic!

@danimo Could you check why I don't have access there (I'm log in)

Contributor

cdamken commented Jul 28, 2016

Some more infos:

https://central.owncloud.org/t/the-requested-uri-login-cannot-be-processed-by-the-script-owncloud-index-php/993

Sorry, you don't have access to that topic!

@danimo Could you check why I don't have access there (I'm log in)

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 28, 2016

@cdamken Sorry, had messed up the permissions. Should work again.

ghost commented Jul 28, 2016

@cdamken Sorry, had messed up the permissions. Should work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment