core icon indicating copy to clipboard operation
core copied to clipboard

Get rid of index.php in the url [$50 awarded]

Open DeepDiver1975 opened this issue 13 years ago • 23 comments

to be clear this is optional and we cannot rely on this.

more info to come ....

DeepDiver1975 avatar Nov 07 '13 14:11 DeepDiver1975

not sure we should spend time with this. than we have two different urls to maintain. and it is only cosmetic anyways

karlitschek avatar Nov 07 '13 14:11 karlitschek

My idea is to setup the rewrite rule in htaccess together with an environment variable if rewrite is enabled.

Based on that variable we include index.php while generating the urls - or not.

Why do we need to get rid of the index.php at all? 1.) clean urls :wink: 2.) in some more complex web server setups we want to apply conditions, rules etc on generated routes. afaik this will not work if there is an index.php in the url

DeepDiver1975 avatar Nov 07 '13 15:11 DeepDiver1975

I figured you want to do that. I'm not convinced that it's worth the work looking at all he other issues like performance and feature requests. :-)

karlitschek avatar Nov 07 '13 15:11 karlitschek

at it's worth the work looking at all he other issues like performance and feature requests. :-)

For sure - I scheduled it for oc7 - maybe someday ... :wink:

DeepDiver1975 avatar Nov 07 '13 15:11 DeepDiver1975

I am also desperately looking for a solution to this.

First, I thought it would be a simple config or app setting, then I read many posts of people, which claimed they've accomplished this by setting mod_rewrite rules and owncloud would detect this magically in his own - I tried this without luck. Others say that in older version this would have been the standard behavior in previous versions and there are also people who say they fixed this with custom a dispatch.php. I read also some posts about problems with /index.php/... in the URL and eg. AppleDAV clients.

Could you please shed some light on this issue, is it possible to do this or why is it not recommended?

PS: Would be more than just a cosmetic issue for me, because cool URIs don't change ;)

schmunk42 avatar Jan 22 '14 22:01 schmunk42

I'm also looking for a solution for this, because under normal circumstances we block anything containing the string '.php' twice in the same URL, as a security measure. Most of the requests that we see of this form are attacks. Most of the rest of the requests that we see of this form involve badly-written student code. But under the hood, there are dozens of requests of this form in OwnCloud. There are no less than six such requests from a single login attempt.

sauergeek avatar May 30 '14 20:05 sauergeek

+1 It is quite easy: http://www.acloudtree.com/how-to-remove-index-php-from-owncloud-url-path/ RewriteRule ^index.php/(.*) $1 [L]

but I would also like to see it as a feature or setting in OC6. It is just one simple setting and one simple .htaccess rule so why should we schedule it for a later major release?

Do you need some more developers?

Some addition: it seems there is some problem with autoloading the class when using the RewriteRule in combination with legacy classes: Fatal error: Class 'OC_Util' not found in /settings/apps.php on line 24

https://github.com/owncloud/core/blob/master/lib/autoloader.php

DanielRuf avatar Jun 21 '14 20:06 DanielRuf

Probably because the rewrite way is not clean enough. There are possibly other side effects and it might take some time to iron them out.

PVince81 avatar Jul 01 '14 15:07 PVince81

There's a great explanation of how to do this using mod_rewrite on Stack Overflow.

koehn avatar Oct 08 '14 15:10 koehn

Although my other ticket was going into a different direction it was closed as a duplicate, thus I want to re-post here what I've mentioned there.

There are actually 2 different topics:

  • removal of index.php from the URL
  • removal of .php from the URL

While the first item is certainly appreciated, it doesn't solve the problem for all other URLs which have .php in them, e.g. https:/server/remote.php/webdav/ and https://server/remote.php/caldav/. So making https://server/index.php/apps/files to https://server/apps/files is definitely nice, but maybe it would be easier just to remove the .php extension from all URLs. In that case the default page would look like https://server/index/apps/files, but it'd be still better than before.

Thus the 2nd item would be more consistent accross the environment and I believe also more maintainable. Removing the .php from the URL are 3 lines in .htaccess. Adding those 3 lines won't break anything, but would allow people to access https://server/remote.php/caldav/ as https://server/remote/caldav/.

The next step would be to change the link creation and references in the server code. I don't know how much code has to be changed to accomplish this, but it should be rather straight forward to do so.

Please let me know, if anything I wrote makes any sense to you.

tessus avatar Dec 05 '14 18:12 tessus

@DeepDiver1975 Did you see my last comment? What do you think? Is this issue just for the removal of index.php, or .php altogether? Is there anything I can help with?

tessus avatar Jan 06 '15 16:01 tessus

from my understanding neither index.php, public.php nor remote.php shall be visible in the url.

but this is a long way - I need to rethink on how to make this happen ....

DeepDiver1975 avatar Jan 06 '15 16:01 DeepDiver1975

well, you can drop me an email. maybe I can help.

tessus avatar Jan 06 '15 16:01 tessus

Proposal is at https://github.com/owncloud/core/pull/14081

LukasReschke avatar Feb 11 '15 00:02 LukasReschke

@DeepDiver1975 are you still looking into this? just wondering. index.php and remote.php are still present in URLs.

If you want, I can have a look at it as well. Please drop me an email or we can discuss this in this thread. I believe there are several ways to handle this. (e.g. remove index.php completely or replace it by something else, let's say cloud).

What do you think? Is it worth looking into this again?

tessus avatar Sep 15 '15 00:09 tessus

low priority from my point of view

karlitschek avatar Sep 15 '15 07:09 karlitschek

Hmmm.... seems that some people REALLY want it and others REALLY couldn't care less. Is there any way of judging the community desire for this? What's being asked is pretty trivial, and is already possible with a couple of hacks in either httpd or nginx, yet even that is frowned upon here... ;-(

gsosna avatar Sep 15 '15 07:09 gsosna

well if it's possible with some webserver config then this should be fine for the people who REALLY care how the urls look like. i assume that most core contributors are looking into more serious bugs and improvements at the moment. :-)

karlitschek avatar Sep 15 '15 07:09 karlitschek

What's being asked is pretty trivial,

@gsosna you are very welcome to submit a pull request to fix this

bildschirmfoto von 2015-09-15 09-59-25

DeepDiver1975 avatar Sep 15 '15 07:09 DeepDiver1975

One way of judging demand is bountysource: https://www.bountysource.com/issues/1328006-get-rid-of-index-php-in-the-url

But that, too, isn't entirely objective - you can promote an issue a bit and it will get more support, of course. And not everybody has money ;-)

jospoortvliet avatar Sep 15 '15 08:09 jospoortvliet