0

In Mage_Core_Controller_Request_Varien_Router_Standard::checkShouldBeSecure there is object $request What is difference between getOriginalPathInfo() and getPathInfo() methods of $request?

4

getOriginalPathInfo will always return the URI that you called.
getPathInfo will return what is being processed internally by Magento, after looking through the url rewrites table

Let's take this example.

http://something.com/electronics.html. - this is the category page for the category with id 13 (I used the sample data).

getOriginalPathInfo will return /electronics.html
getPathInfo will return catalog/category/view/id/13

If there is no value in the url rewrites table for the url you request then both methods return the same thing.

1

I think this is the code you are looking for:

File: app/code/core/Mage/Core/Controller/Varien/Router/Standard.php

// get controller name
if ($request->getControllerName()) {
    $controller = $request->getControllerName();
} else {
    if (!empty($p[1])) {
        $controller = $p[1];
    } else {
        $controller = $front->getDefault('controller');
        $request->setAlias(
            Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS,
            ltrim($request->getOriginalPathInfo(), '/')
        );
    }
}

In the code above, We first ask the request object if a custom controller has been set elsewhere. If not (the normal state of affairs first time through), we look at the second part of our path information ($p[1]). If there’s nothing in there, we go to the default set on the front controller object (in a normal operating system, that’s index)

$pathInfo = $request->getPathInfo();

This is the code that pulls the path information from the request object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.