1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-18 03:31:54 +02:00

Fixes #937 - detect of mod-rewrite is possible. New constant: e_MOD_REWRITE

This commit is contained in:
Cameron 2015-03-31 07:25:39 -07:00
parent b8d2f6667c
commit afb8d290e5
3 changed files with 21 additions and 4 deletions

View File

@ -38,6 +38,9 @@
### LimitRequestBody 10240000
<IfModule mod_rewrite.c>
SetEnv HTTP_MOD_REWRITE On
### enable rewrites
Options +FollowSymLinks
RewriteEngine On

View File

@ -63,6 +63,14 @@ class eurl_admin_ui extends e_admin_controller_ui
public function init()
{
$htaccess = file_get_contents(e_BASE.".htaccess");
if(strpos($htaccess, 'SetEnv HTTP_MOD_REWRITE On')===false)
{
e107::getMessage()->addWarning("Mod-rewrite is disabled. Please add the following to your <b>.htaccess</b> file after the line \"Rewrite Engine On\":<br /><pre>SetEnv HTTP_MOD_REWRITE On</pre>");
}
if(is_array($_POST['rebuild']))
{
@ -151,12 +159,18 @@ class eurl_admin_ui extends e_admin_controller_ui
public function simplePage()
{
// $this->addTitle("Simple Redirects");
$eUrl =e107::getAddonConfig('e_url');
$eUrl =e107::getAddonConfig('e_url');
if(empty($eUrl))
{
return;
}
$text = "";

View File

@ -2617,9 +2617,7 @@ class e107
if(varset($tmp[$plugin][$key]['sef']))
{
$mode = 'sef'; //TODO Auto-detect when mod-rewrite is active.
if($mode == 'sef') // Search-Engine-Friendly URL
if(deftrue('e_MOD_REWRITE')) // Search-Engine-Friendly URL
{
$rawUrl = $tp->simpleParse($tmp[$plugin][$key]['sef'], $row);
return e_HTTP.$rawUrl;
@ -3004,6 +3002,8 @@ class e107
define('CHARSET', 'utf-8'); // set CHARSET for backward compatibility
define('e_MOD_REWRITE', (getenv('HTTP_MOD_REWRITE')=='On' ? true : false));
// Define the domain name and subdomain name.
if(is_numeric(str_replace(".","",$_SERVER['HTTP_HOST'])))
{