Jump to content

[Solved]Weird behavior of internal redirection


Recommended Posts

Hello everyone,


 


It seems that since few weeks ago google is indexing some of our pages like the following way:


www.domain.extension/index.php/[page | directory].


 


Let me tell you how we work with prestashop.


 


We've got the 1.4.7.0 version and we didn't install any module for months and i've tried to erase each single .htaccess we had to check if it was so without any luck.


 


Our hosting works with php modules such as mod_rewrite (Initially I thought it was an issue with code igniter nor nginx).


 


Our main .htaccess is very custom and modified but let me re-type that we erased it to check if it was the issue and didn't work.


 


An example:


 


http://www.imprentao...x.php/index.php


 


I'm missed pretty much with this, i'm not finding the loop anywhere. Our sys hosing advised us to upgrade our prestashop version but that would mean months of work since we've our prestashop highly modified. What makes me crazy is that we just noticed those indexed sites like a week ago thank to google webmaster tools but it seems that this loop happened to us for ages now since I've an older version of the site into a sandbox and behaves the same way.


 


Ah, forgot to mention that i've tried to disable friendly URL and the redirection to canonical URL with same results:


 


http://www.imprentao...hp/folletos.php


 


Regards,  


Edited by karldeux (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Could just fix the issue. I was using a "hack" to call index.php
 

<?php
include(dirname(__FILE__) . '/config/config.inc.php');
include(dirname(__FILE__) . '/headerIndex.php'); 
$smarty->display(_PS_THEME_DIR_.'indexModificado.tpl');
include(dirname(__FILE__) . '/footer.php');

And switched again for:
 

require(dirname(__FILE__).'/config/config.inc.php');
ControllerFactory::getController('IndexController')->run();

Then modified IndexController adding this:
 

public function displayHeader() {

	global $css_files, $js_files, $css_content;

	if (!self::$initialized) {
	    $this->init();
	}

	$css_files[_THEME_CSS_DIR_ . 'global.css'] = 'all';
	$css_files[_THEME_CSS_DIR_ . 'index.css'] = 'all';
	$js_files = array();
	$js_files[0] = "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js";

	// P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies)
	header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');

	/* Hooks are volontary out the initialize array (need those variables already assigned) */
	self::$smarty->assign(array(
	    'time' => time(),
	    'img_update_time' => Configuration::get('PS_IMG_UPDATE_TIME'),
	    'static_token' => Tools::getToken(false),
	    'token' => Tools::getToken(),
	    'logo_image_width' => Configuration::get('SHOP_LOGO_WIDTH'),
	    'logo_image_height' => Configuration::get('SHOP_LOGO_HEIGHT'),
	    'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_,
	    'content_only' => (int) Tools::getValue('content_only')
	));
	self::$smarty->assign(array(
	    'HOOK_HEADER' => Module::hookExec('header'),
	    'HOOK_TOP' => Module::hookExec('top'),
	    'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn')
	));

	self::$smarty->assign('css_content', $css_content);

	if (isset($css_files) AND !empty($css_files)) {
	    self::$smarty->assign('css_files', $css_files);
	}

	if (isset($js_files) AND !empty($js_files)) {
	    self::$smarty->assign('js_files', $js_files);
	}

	if (isset($maintenance) AND (!isset($_SERVER['REMOTE_ADDR']) OR $_SERVER['REMOTE_ADDR'] != Configuration::get('PS_MAINTENANCE_IP'))) {
	    header('HTTP/1.1 503 temporarily overloaded');
	    self::$smarty->display(_PS_THEME_DIR_ . 'maintenance.tpl');
	    exit;
	}

	self::$smarty->display(_PS_THEME_DIR_ . 'headerIndex.tpl');

    }

So this way the index will have its own tpl for header. 
 
Infinite redirection stopped doing this.
 
Reggards

Link to comment
Share on other sites

×
×
  • Create New...