diff --git a/admin-dev/themes/default/template/controllers/generator/helpers/options/options.tpl b/admin-dev/themes/default/template/controllers/generator/helpers/options/options.tpl index cd2269afa..e2f5bfd98 100644 --- a/admin-dev/themes/default/template/controllers/generator/helpers/options/options.tpl +++ b/admin-dev/themes/default/template/controllers/generator/helpers/options/options.tpl @@ -27,10 +27,10 @@ {block name="defaultOptions"}
{l s='Htaccess file generation'} -

+

{l s='Warning:'} {l s='this tool can ONLY be used if you are hosted by an Apache web server. Please ask your webhost.'} -

+

{l s='This tool will automatically generate a ".htaccess" file that will give you the ability to do URL rewriting and to catch 404 errors.'}

@@ -44,8 +44,16 @@
 
- -

{l s='Enable only if your server allows URL rewriting.'}

+ {if $mod_rewrite} + +

{l s='Enable only if your server allows URL rewriting.'}

+ {else} + + {l s='URL rewriting (mod_rewrite) is not active on your server. If you want to use Friendly URL you have to active this mod.'} + +
+ {/if} +
 
diff --git a/admin-dev/themes/default/template/controllers/meta/helpers/options/options.tpl b/admin-dev/themes/default/template/controllers/meta/helpers/options/options.tpl new file mode 100644 index 000000000..b34b1544c --- /dev/null +++ b/admin-dev/themes/default/template/controllers/meta/helpers/options/options.tpl @@ -0,0 +1,43 @@ +{* +* 2007-2012 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2012 PrestaShop SA +* @version Release: $Revision: 13686 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{extends file="helpers/options/options.tpl"} +{block name="start_field_block"} +
+ {if $field['type'] == 'rewriting_settings'} + {if $field['mod_rewrite']} + + + + + + + {else} + {l s='URL rewriting (mod_rewrite) is not active on your server. If you want to use Friendly URL you have to active this mod.'} +
+ {/if} + {/if} +{/block} \ No newline at end of file diff --git a/classes/Tools.php b/classes/Tools.php index 646a84337..80151c27e 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -2221,6 +2221,11 @@ FileETag INode MTime Size for ($len; $len > 0; $len--) $str .= '.0'; } + + public static function modRewriteActive() + { + return (in_array('mod_rewrite', apache_get_modules()) ? true : false); + } } /** diff --git a/controllers/admin/AdminGeneratorController.php b/controllers/admin/AdminGeneratorController.php index 2a36dee31..99b124d80 100644 --- a/controllers/admin/AdminGeneratorController.php +++ b/controllers/admin/AdminGeneratorController.php @@ -45,6 +45,7 @@ class AdminGeneratorControllerCore extends AdminController $this->tpl_option_vars['checkConfiguration_rb'] = $this->checkConfiguration($this->rb_file); $this->tpl_option_vars['ps_htaccess_cache_control'] = Configuration::get('PS_HTACCESS_CACHE_CONTROL'); $this->tpl_option_vars['ps_rewriting_settings'] = Configuration::get('PS_REWRITING_SETTINGS'); + $this->tpl_option_vars['mod_rewrite'] = Tools::modRewriteActive(); $this->tpl_option_vars['ps_htaccess_disable_multiviews'] = Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS'); parent::initContent(); diff --git a/controllers/admin/AdminMetaController.php b/controllers/admin/AdminMetaController.php index be1cc636a..db52f1c32 100644 --- a/controllers/admin/AdminMetaController.php +++ b/controllers/admin/AdminMetaController.php @@ -48,16 +48,18 @@ class AdminMetaControllerCore extends AdminController ); $this->_group = 'GROUP BY a.id_meta'; + $mod_rewrite = Tools::modRewriteActive(); $this->options = array( 'general' => array( 'title' => $this->l('URLs Setup'), 'fields' => array( 'PS_REWRITING_SETTINGS' => array( 'title' => $this->l('Friendly URL'), - 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)'), + 'desc' => ($mod_rewrite ? $this->l('Enable only if your server allows URL rewriting (recommended)') : ''), 'validation' => 'isBool', 'cast' => 'intval', - 'type' => 'bool' + 'type' => 'rewriting_settings', + 'mod_rewrite' => $mod_rewrite ), 'PS_CANONICAL_REDIRECT' => array( 'title' => $this->l('Automatically redirect to Canonical url'), diff --git a/css/admin.css b/css/admin.css index 68a20109d..512f41f85 100644 --- a/css/admin.css +++ b/css/admin.css @@ -1822,7 +1822,7 @@ p.preference_description .light-warning { font-style: italic; } -.multishop_warning{ +.multishop_warning, .warning_mod_rewrite{ background-image: url("../img/admin/warning.gif"); background-repeat: no-repeat; color: #FE2744;