mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Remove rewrite-less routing through index.php
It's currently broken (doesn't rewrite subsequent links), and is of questionable use. It was introduced during a time when PHP didn't have a built-in webserver (I think). Virtually ever webserver will have rewriting capabilities these days (even IIS!), and if you struggle with the setup as a new user, you can just fall back to PHP's built-in webserver. This doesn't affect installation capabilities, since these are triggered via install.php.
This commit is contained in:
parent
1e051386c6
commit
1e913bb938
@ -20,14 +20,6 @@ By default, requests will be passed through for files existing on the filesystem
|
||||
Some access control is in place to deny access to potentially sensitive files in the webroot, such as YAML configuration files.
|
||||
If no file can be directly matched, control is handed off to `index.php`.
|
||||
|
||||
SilverStripe can also operate without this level of rewriting, in which case
|
||||
you'll have `index.php` as part of the URL.
|
||||
|
||||
<div class="notice" markdown="1">
|
||||
Running SilverStripe without web server based rewriting is not recommended since it
|
||||
can leave sensitive files exposed to public access (the `RewriteRule` conditions from above don't apply).
|
||||
</div>
|
||||
|
||||
## Bootstrap
|
||||
|
||||
The `constants.php` file is included automatically in any project which requires silverstripe/framework.
|
||||
|
@ -84,6 +84,8 @@ The location of SilverStripe's "entry file" has changed. Your project and server
|
||||
to adjust the path to this file from `framework/main.php` to `index.php`.
|
||||
If you are running Apache, adjust your `.htaccess` file. For other webservers,
|
||||
please consult the [installation guides](getting_started/installation/).
|
||||
Since 4.0, URL rewrite capabilities are required,
|
||||
unless you PHP's built-in webserver through [silverstripe/serve](https://github.com/silverstripe/silverstripe-serve).
|
||||
|
||||
The `index.php` file should already exist in your project,
|
||||
but needs its content replaced:
|
||||
|
@ -130,10 +130,6 @@ class HTTPRequestBuilder
|
||||
// Remove query parameters (they're retained separately through $server['_GET']
|
||||
$url = parse_url($variables['_SERVER']['REQUEST_URI'], PHP_URL_PATH);
|
||||
|
||||
// Remove SCRIPT_NAME from url in case no rewriting is in place on the webserver.
|
||||
// Example: index.php/admin/pages -> /admin/pages
|
||||
$url = preg_replace('#^' . preg_quote($server['SCRIPT_NAME'], '#') . '#', '', $url);
|
||||
|
||||
// Remove base folders from the URL if webroot is hosted in a subfolder
|
||||
if (substr(strtolower($url), 0, strlen(BASE_URL)) === strtolower(BASE_URL)) {
|
||||
$url = substr($url, strlen(BASE_URL));
|
||||
@ -144,5 +140,4 @@ class HTTPRequestBuilder
|
||||
|
||||
return $variables;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -881,7 +881,7 @@ class InstallRequirements
|
||||
if ($this->testApacheRewriteExists()) {
|
||||
return true;
|
||||
} else {
|
||||
$this->warning($testDetails);
|
||||
$this->error($testDetails);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user