diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-12-01 17:17:48 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-12-01 17:17:48 +0100 |
commit | 8931ba4a0d574a05cf4415f2556bdd3ee0388ba9 (patch) | |
tree | 38635a8d2181478f8200c5bb7dea96b26c184822 /lib/private | |
parent | 74e8c25a5b48eb4b675de262ced1702dec4307f4 (diff) | |
parent | 2515cb17be18da4aee32167259ee75fdc7a5a56b (diff) | |
download | nextcloud-server-8931ba4a0d574a05cf4415f2556bdd3ee0388ba9.tar.gz nextcloud-server-8931ba4a0d574a05cf4415f2556bdd3ee0388ba9.zip |
Merge pull request #14081 from owncloud/use-pretty-urls
Support pretty URLs
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/route/router.php | 8 | ||||
-rw-r--r-- | lib/private/setup.php | 6 | ||||
-rw-r--r-- | lib/private/urlgenerator.php | 2 | ||||
-rw-r--r-- | lib/private/util.php | 7 |
4 files changed, 20 insertions, 3 deletions
diff --git a/lib/private/route/router.php b/lib/private/route/router.php index 6d3b7c742bb..25860ee46bf 100644 --- a/lib/private/route/router.php +++ b/lib/private/route/router.php @@ -85,9 +85,15 @@ class Router implements IRouter { */ protected $logger; + /** + * @param ILogger $logger + */ public function __construct(ILogger $logger) { $this->logger = $logger; - $baseUrl = \OC_Helper::linkTo('', 'index.php'); + $baseUrl = \OC::$WEBROOT; + if(!(getenv('front_controller_active') === 'true')) { + $baseUrl = \OC_Helper::linkTo('', 'index.php'); + } if (!\OC::$CLI) { $method = $_SERVER['REQUEST_METHOD']; } else { diff --git a/lib/private/setup.php b/lib/private/setup.php index 8f1ae389e45..1f91240e9da 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -432,6 +432,12 @@ class Setup { //custom 404 error page $content.= "\nErrorDocument 404 ".\OC::$WEBROOT."/core/templates/404.php"; } + + // Add rewrite base + $content.="\n<IfModule mod_rewrite.c>"; + $content.="\n RewriteBase ".\OC::$WEBROOT; + $content.="\n</IfModule>"; + if ($content !== '') { //suppress errors in case we don't have permissions for it @file_put_contents($setupHelper->pathToHtaccess(), $content . "\n", FILE_APPEND); diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php index 428a222f9c7..fb1ea737ef4 100644 --- a/lib/private/urlgenerator.php +++ b/lib/private/urlgenerator.php @@ -90,7 +90,7 @@ class URLGenerator implements IURLGenerator { * Returns a url to the given app and file. */ public function linkTo( $app, $file, $args = array() ) { - $frontControllerActive=($this->config->getSystemValue('front_controller_active', 'false') == 'true'); + $frontControllerActive = (getenv('front_controller_active') === 'true'); if( $app != '' ) { $app_path = \OC_App::getAppPath($app); diff --git a/lib/private/util.php b/lib/private/util.php index 84a8c49c383..5466082d030 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -1073,7 +1073,12 @@ class OC_Util { break; } } - $location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/'); + + if(getenv('front_controller_active') === 'true') { + $location = $urlGenerator->getAbsoluteURL('/apps/' . $appId . '/'); + } else { + $location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/'); + } } } return $location; |