You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Get rid of index.php in the url [$50 awarded] #5744
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 😉
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
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 ;)
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.
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
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.
@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?
@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?
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... ;-(
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. :-)
And as @karlitschek pointed out - if it is indeed a simple server setting, let's document it! I offer help with documenting it as, personally, I like shorter sharing links ;-)
A simple server setting won't fix this. Our routing will explode then in some cases, which makes the whole ownCloud explode. There needs to be at least 1 change to the router as done in #14081
That said #14081 is pretty much complete but just requires somebody with time to fix all the unit tests etc…
Activity
karlitschek commentedon Nov 7, 2013
not sure we should spend time with this. than we have two different urls to maintain. and it is only cosmetic anyways
DeepDiver1975 commentedon Nov 7, 2013
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 😉
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
karlitschek commentedon Nov 7, 2013
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. :-)
DeepDiver1975 commentedon Nov 7, 2013
For sure - I scheduled it for oc7 - maybe someday ... 😉
schmunk42 commentedon Jan 22, 2014
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 ;)
sauergeek commentedon May 30, 2014
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.
DanielRuf commentedon Jun 21, 2014
+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 24https://github.com/owncloud/core/blob/master/lib/autoloader.php
PVince81 commentedon Jul 1, 2014
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.
koehn commentedon Oct 8, 2014
There's a great explanation of how to do this using
mod_rewriteon Stack Overflow.tessus commentedon Dec 5, 2014
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:
While the first item is certainly appreciated, it doesn't solve the problem for all other URLs which have
.phpin them, e.g.https:/server/remote.php/webdav/andhttps://server/remote.php/caldav/.So making
https://server/index.php/apps/filestohttps://server/apps/filesis definitely nice, but maybe it would be easier just to remove the.phpextension 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
.phpfrom the URL are 3 lines in .htaccess. Adding those 3 lines won't break anything, but would allow people to accesshttps://server/remote.php/caldav/ashttps://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 commentedon Jan 6, 2015
@DeepDiver1975 Did you see my last comment? What do you think? Is this issue just for the removal of
index.php, or.phpaltogether?Is there anything I can help with?
DeepDiver1975 commentedon Jan 6, 2015
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 ....
tessus commentedon Jan 6, 2015
well, you can drop me an email. maybe I can help.
LukasReschke commentedon Feb 11, 2015
Proposal is at #14081
tessus commentedon Sep 15, 2015
@DeepDiver1975 are you still looking into this? just wondering.
index.phpandremote.phpare 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?
karlitschek commentedon Sep 15, 2015
low priority from my point of view
gsosna commentedon Sep 15, 2015
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... ;-(
karlitschek commentedon Sep 15, 2015
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. :-)
DeepDiver1975 commentedon Sep 15, 2015
@gsosna you are very welcome to submit a pull request to fix this
jospoortvliet commentedon Sep 15, 2015
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 commentedon Sep 15, 2015
And as @karlitschek pointed out - if it is indeed a simple server setting, let's document it! I offer help with documenting it as, personally, I like shorter sharing links ;-)
LukasReschke commentedon Sep 15, 2015
A simple server setting won't fix this. Our routing will explode then in some cases, which makes the whole ownCloud explode. There needs to be at least 1 change to the router as done in #14081
That said #14081 is pretty much complete but just requires somebody with time to fix all the unit tests etc…
[-]Get rid of index.php in the url[/-][+]Get rid of index.php in the url [$50 awarded][/+]lock commentedon Aug 3, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.