function system_check_clean_urls
Search API
7.x system.module | system_check_clean_urls() |
6.x system.module | system_check_clean_urls() |
5.x system.module | system_check_clean_urls() |
This function will attempt to confirm that "clean URLs" is functioning, and allowed on this server.
Returns TRUE or FALSE
2 calls to system_check_clean_urls()
- system_enable in modules/
system/ system.install - Implementation of hook_enable.
- system_settings_form in modules/
system/ system.module - This is the "system settings" form.
File
- modules/
system/ system.module, line 195
Code
function system_check_clean_urls() {
// Are clean-url's enabled?
// We will do this by trying to retrieve a test URL, built into index.php.
// If we can get a success message back from "http://example.com/flightpath/test-clean-urls/check", then
// we are good to go.
// First, figure out the base URL.
$protocol = strpos(strtolower($_SERVER ['SERVER_PROTOCOL']), 'https') === FALSE ? 'http' : 'https';
$host = $_SERVER ['HTTP_HOST'];
$script = $_SERVER ['SCRIPT_NAME'];
$base_url = $protocol . "://" . $host . $script;
$base_url = str_replace("/install.php", "", $base_url);
$base_url = str_replace("/index.php", "", $base_url);
// Try to get our test URL's success message...
$res = fp_http_request($base_url . '/test-clean-urls/check');
if ($res->code != 200) {
// There was an error or some other problem!
// But wait-- did we get redirected?
if (isset($res->redirect_code) && $res->redirect_code == 200) {
return TRUE; // it's OK after all!
}
return FALSE;
}
// If we made it here, it must have worked.
return TRUE;
}