All posts tagged configuration

@Note: the solution below is not for the moment 100% compatible with third party modules like GoogleBase. I will try to find an improved way. There is a note below for developer to help to find a better way. Thx for your feedback.

Note: a functionnal solution is provided at the end of this article thanks to Frank in the comments.

For those who meet a problem with their Magento backend after to have customized the url access (e.g. thanks to the file /app/etc/local.xml. They can get an error page 404 – Page Not Found after to be logged. This situation exists only if you have activated the configuration Store Code into URL ( System > Configuration > Web > Url Options > Add Store Code to Urls – YES).

The solution is to tell to Magento to not use Store Code in url for our customized url backend. You just need to edit the file local.xml in the following way: {backend_customized_name} = backend in our exemple

Below an exemple of local.xml file:

    <{backend_name_customized} />

Replace only {backend_customized_name} by backend (in our example) or else. Then you won’t get anymore this 404 error for adminhtml modules.

If you want to deep more about this subject, take a look in the file /app/code/core/Mage/Core/Controller/request/Http.php line 148. The problem comes from here.

if ($this->_canBeStoreCodeInUrl()) {
$pathParts = <a href="">explode</a>('/', <a href="">ltrim</a>($pathInfo, '/'), 2);
$storeCode = $pathParts[0];

if (!$this->isDirectAccessFrontendName($storeCode)) {
	$stores = Mage::app()->getStores(true, true);
	if ($storeCode!=='' && <a href="">isset</a>($stores[$storeCode])) {
		$pathInfo = '/'.(<a href="">isset</a>($pathParts[1]) ? $pathParts[1] : '');
	elseif ($storeCode !== '') {

Solution from Frank: A solution for this problem is to change the action of the login form.
File is in app/design/adminhtml/default/default/template/login.phtml.
Replace the line

<form method="post" action="" id="loginForm">


<form method="post" action="http://<?php echo $_SERVER['HTTP_HOST']; ?>/admin/admin/" id="loginForm">