-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Support pretty URLs #14081
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
Support pretty URLs #14081
Conversation
1d169a2 to
4216dc9
Compare
4216dc9 to
20636b9
Compare
|
This is obviously only for Apache as I have no idea at all how to use or configure other webservers ;-) |
|
To test enable mod_rewrite and mod_env, things should work magically. Old URLs with |
|
Please notice that supporting this obviously also requires twice as much QA ;-) (i.e. on a server with mod_rewrite installed and another one without) |
.htaccess
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Black voodoo because there is no static folder (as in most frameworks such as Symfony) and thus we have to do that guessing here.
|
Subscribing |
|
great initiative @LukasReschke THX I already did introduce a config flag for removing index.php from the generated urls - maybe you can reuse this one - https://github.com/owncloud/core/blob/use-pretty-urls/lib/private/urlgenerator.php#L70 |
I think it would make more sense if we stick with the automatic approach implemented here instead of relying on some configuration switch. As far I understand most people don't change anything in the config and neither do we devs, so if something is standard in most environments it gets automatically better tested. But we can also make this a configuration only option if desired. |
|
To follow this automatic approach we could add a rewrite rule to the nginx config in the manual and set an env to detect the redirect rule. |
|
The nginx configuration is very simple, and in fact doesn't need any rewrites at all. I'm using: However, getting that environment variable into PHP-FPM is proving difficult. I tried I think @DeepDiver1975 's suggestion of using a config.php variable is the best. It makes it much easier for other web servers, and is actually easier to set that way. I know we lose the automatic aspect, but setting something in config.php is easy, while setting something in PHP-FPM or nginx.conf (and even then I don't know what) is more difficult. |
|
Setting the env in the config wouldn't be an issue if possible because most But a config setting would be enough. In my opinion people not being able Am 11. Februar 2015 19:31:40 schrieb Robin McCorkell
|
67be357 to
1978016
Compare
|
As discussed with @DeepDiver1975 we can use the automatic approach since this will lead to problems in some deployment scenarios and our goal is to be as easy to install as possible. Thus I migrated this to the |
|
@mitar @MorrisJobke The documented nginx config already has the following I don't see a reason to include index.html/index.htm when these aren't present very often in owncloud, and as far I know owncloud doesn't use arguments so the try_files line we have is fine as is. Finally if you are going to use args with nginx the cleanest way is |
|
The point is that the resulting URL is just internal, so OwnCloud might not use them, but plugins might? |
|
So there is no need to provide |
|
As I stated, "/index.php" is already in the documented nginx config. and try_files doesn't "provide" $uri to index.php, it tries the provided uri, uri with a slash (which would check "$uri/index.php"), then finally redirects to the main /index.php page. But if apps do use arguments we should replace "/index.php" with "/index.php$is_args$args" in the try_files line in the documented config. |
|
Here's my go at a working Nginx configuration: https://gist.github.com/stevenmirabito/5560ba2feea9eeb32db1 I've been ironing out the kinks and everything seems to be working on my installation. I did have a problem with the change to Unfortunately, due to the way ownCloud is set up, a simple Let me know if anyone has any questions or suggestions. Hope this helps! |
|
@stevenmirabito what are you trying to accomplish? hiding index.php from the URL? |
|
@mitar I just realized what you were trying to say earlier, my mistake you were trying to pass the uri to index.php, not just arguments, (I missed that part!) so @stevenmirabito you tried |
|
@josh4trunks Yes, that's the entire point of this pull request. @LukasReschke provided the Apache mod_rewrite config, what I posted above is for Nginx. Like I said, I did try a |
|
Hello, Thanks |
|
This is a New feature of 9.0 |
|
@josh4trunks @stevenmirabito @mitar Let's move the discussion about the needed changes in the nginx config to owncloud-archive/documentation#2014 Havn't noticed your posts in here and that info could be really useful there. |
How to enable this for Apache2? To automatically (maybe 302 redirect?) used the URL: |
|
huh, did i get all of you wrong? so i've added
also i tried to add tl;dr is this behavior right as it should be of today or did i miss something? |
|
@pandorra2 That command, and the config.php option, will only available in 9.0.3 and above |
|
@pandorra2 @thejustsoul I found that |
|
With all the information here, I'm confused again how to setup 9.0.2 to remove index.php and also 9.0.3. Can someone provide step by step instructions on how to setup 9.0.2 (without front_controller_active) and 9.0.3 to make it work, also in update cases ? This is important for update testing and to make packaging properly compatible (see #23512) Thanks. |
|
So, I did some tests and here is the result: owncloud-archive/documentation#2205 (comment) It seems that having a writable ".htaccess" with properly configured web server for ".htaccess" seems to be enough. Installing or upgrading ownCloud would maintain the proper values there. Next step: figure out what, how and why to use "front_controller_active" and also add info in the doc ticket. |
|
Ok, turns out there are some docs here: owncloud-archive/documentation#2431 |
|
After enabling this, everything works fine except ajax "drap&drop" uploads. The POST request calls
When I disable |
|
@basert upload.php shouldn't be one of the scripts owncloud executes. Are you using nginx? If so it sounds like your config isn't correct for owncloud 9. Can you post it so I can take a look. |
|
Sure, thanks, here's a GIST of my config: |
|
@basert You shouldn't use such an older Pull Request for such questions / issues. Either create a new issue if you think there is a bug within this feature or ask for support at either the users malinglist or the forums (see https://owncloud.org/support). But just had a short look at your nginx config which doesn't match the config provided here: This one is known to work with the pretty urls. |
|
+1 for config for apache |

This changeset allows ownCloud to run with pretty URLs, they will be used by default if mod_rewrite and mod_env are available. This means basically that the
index.phpin the URL is not shown to the user anymore.Also the not deprecated functions to generate URLs have been modified to support this behaviour, old functions such as
filePathwill still behave as before for compatibility reasons.Examples:
http://localhost/index.php/s/AIDyKbxiRZWAAjP => http://localhost/s/AIDyKbxiRZWAAjP
http://localhost/index.php/apps/files/ => http://localhost/apps/files/
Due to the way our CSS and JS is structured the .htaccess uses some hacks for the final result but could be worse... And I was just annoyed by all that users crying for the removal of
index.php;-)@karlitschek @DeepDiver1975 Please decide if this is something we want to have. If yes I'll see how we could best unit-test this…
Fixes #5744
Fixes #12345