EDIT:
This seems to have been caused by my CREARESEO extension. I had to uninstall to find that out since disabling the extension fooled me into thinking it was something else. I am working on locating the file that is interrupting Magento's default redirect, any guidance would be greatly appreciated.
Original Post
How can I debug product redirect?
I am tracking products in Google Shopping by appending ?utm_source=google_shopping to the product URL. The problem is that for some reason Magento will not allow URL parameters on product URLs.
If my product url is /product-one.html?this=parameter it 301 redirects to /product-one.html.
EDIT: This only happens on product pages. If I append category or CMS page urls with URL parameters they work fine. That said, if my category URL is /recipes and I type the old URL of /recipes.html?this=parameter "?this=parameter" is lost.
I have disabled my SEO extensions and when I do a var_dump of $request on line 202 of /mage/core/controller/varien/router/standard.php it knows that the requested URL has the parameters but it chooses not to preserve them in the redirect.
object(Mage_Core_Controller_Request_Http)#35 (26) {
["_originalPathInfo":protected]=>
string(33) "/cinnamon.html"
["_storeCode":protected]=>
NULL
["_requestString":protected]=>
string(33) "/cinnamon.html"
["_rewritedPathInfo":protected]=>
array(5) {
[0]=>
string(7) "catalog"
[1]=>
string(7) "product"
[2]=>
string(4) "view"
[3]=>
string(2) "id"
[4]=>
string(4) "9736"
}
["_requestedRouteName":protected]=>
NULL
["_routingInfo":protected]=>
array(0) {
}
["_route":protected]=>
string(13) "ajaxaddtocart"
["_directFrontNames":protected]=>
NULL
["_controllerModule":protected]=>
string(17) "FME_Ajaxaddtocart"
["_isStraight":protected]=>
bool(false)
["_beforeForwardInfo":protected]=>
array(0) {
}
["_paramSources":protected]=>
array(2) {
[0]=>
string(4) "_GET"
[1]=>
string(5) "_POST"
}
["_requestUri":protected]=>
string(37) "/catalog/product/view/id/9736?this=ok"
["_baseUrl":protected]=>
string(0) ""
["_basePath":protected]=>
NULL
["_pathInfo":protected]=>
string(35) "/ajaxaddtocart/product/view/id/9736"
["_params":protected]=>
array(1) {
["id"]=>
string(4) "9736"
}
["_rawBody":protected]=>
NULL
["_aliases":protected]=>
array(1) {
["rewrite_request_path"]=>
string(32) "cinnamon.html"
}
["_dispatched":protected]=>
bool(true)
["_module":protected]=>
string(13) "ajaxaddtocart"
["_moduleKey":protected]=>
string(6) "module"
["_controller":protected]=>
string(7) "product"
["_controllerKey":protected]=>
string(10) "controller"
["_action":protected]=>
string(4) "view"
["_actionKey":protected]=>
string(6) "action"
}
I modified the file mentioned above in hopes of forcing the parameters to be inherited by the rewritten rule to no avail.
$requestedURL=$request->getRequestUri();
$urlAliases=$request->getAliases();
$urlAlias=$urlAliases['rewrite_request_path'];
$parametersOfRequestedURL=strstr($requestedURL,"?",false);
if($parametersOfRequestedURL){
echo $newRequestURL=$urlAlias.$parametersOfRequestedURL;
$request->setRequestUri($newRequestURL);
var_dump($request);
die;
//$request->setRequestUri();
}
Removed HTACCESS as it seems to not be a part of the problem. Will provide if requested.
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} !^/subdomain/piwik/ ...
and retest