IT related news, fotography, fun and webdevelopment
14 jun
Dutch
Het probleem
Na het upgraden van Magento naar versie 1.4.0.1 was er een klein probleem met het doorsturen naar de startpagina in de backoffice.
Na iedere keer inloggen resulteerde dit in een 404 pagina.
Omdat ik het niet in elke webshop had, ben ik opzoek gegaan naar het probleem.
Het probleem is het toevoegen van de winkelcode aan de URL, bij een meertalige webshop is dit voor SEO een must zodat je bijvoorbeeld URL’s als www.voorbeeldschop.nl/nl/categorie/product.html krijgt. Hierdoor kan je unieke URL’s per land uitserveren.
Echter worden deze codes ook in het admin gedeelte (de backoffice) gebruikt, standaard is hier de ’storecode’ admin.
Omdat het backoffice standaard is te benaderen via www.voorbeeldschop.nl/admin en hier nog de storecode aan moet worden toegevoegd, krijg je feitelijk dus www.voorbeeldschop.nl/admin/admin/.
De oplossing
Omdat in het inlog formulier geen HTML action staat, zal het formulier de huidige URL gebruiken, als u de backoffice dus benaderd zonder extra storecode, maar wel deze instelling aan heeft staan, (dit is trouwens hier in te stellen: System->Configuration->General->Store Code to URLs), zal het formulier naar de verkeerde URL gaan, namelijk de versie zonder store code.
Wil je wel de backoffice kunnen benaderen zonder www.voorbeelshop.nl/admin/admin te moeten gebruiken, pas dan het volgende aan:
app/design/adminhtml/{theme}/{template}/template/login.phtml on linenumber 48
<form method="post" action="" id="loginForm">;
Vervang met:
<form method="post" action="http://<?php echo $_SERVER['HTTP_HOST']; ?>/admin/admin/" id="loginForm">
Let op
Gebruikt u een aangepaste admin-URL dan doet u deze op te geven i.p.v. ‘admin’.
English
The problem
After upgrading to 1.4.0.1 Magento we had a 404 after each login action.
Because I do not have this issue by any shop, I started looking for a solution.
The problem is due to the “Add Store Code to URL” setting.
It adds the storecode to the URL.
This storecode is also expected in the admin area.
By default, the login form called via (domain) / admin and no action on the form is passed, thus there is no known storecode.
The solution
Als je het inlogformulier aanroep via {domein}/admin/admin zal het werken.
If you also want (domain) / admin work, change the following:
app/design/adminhtml/{theme}/{template}/template/login.phtml on linenumber 48
<form method="post" action="" id="loginForm">
Replace with:
<form method="post" action="http://<?php echo $_SERVER['HTTP_HOST']; ?>/admin/admin/" id="loginForm">
12 Responses for "Magento: 404 page in backoffice after login"
Helemaal goed, dank voor de uitleg!
Thanks!
But I rather prefer the following line as some setups might be in subfolders:
<form method="post" action="admin/” id=”loginForm”>
Your solution assumes that Magento installations are in the root.
phpTag echo Mage::getBaseUrl() ?>admin/
True, my solution assumes that Magento is installed in the root.
You solution is a more generic.
Thanks for your tip.
There is an other solution by editing the file /app/etc/local.xml and set between the tag GLOBAL this:
Replace admin by an other for example: backend or else. it depends on what you defined for in local.xml
There is a problem with this solution, some third party won’t work correctly exple Googlebase, or any other module different of adminhtml. The problem comes from file /app/code/core/Mage/Core/Controller/request/Http.php line 148
Content of local.xml in my previous comment has been erased. See this page http://diglin.com/diglin/en/home/35-magento/68-magento-admin-page-404-error-not-found-lorsque-vous-personnalisez-lurl-dacces-de-votre-backend.html
Works for me – thanks!
I used this in the action:
< ? getUrl('adminhtml'); ?>
Not sure if it makes any difference though.
In any case – helpful post.
For some reason the php tag was taken out… I used this in the action so I posted it again here.
`echo Mage::helper(’adminhtml’)->getUrl(’adminhtml’);`
I do prefer
<form method="post" action="/admin/” id=”loginForm”>
greetings
Mage::getBaseUrl() . “/admin/”
Kort samen gevat:
Vervang de regel
met
<form method="post" action="getUrl(’adminhtml’) ?>” id=”loginForm”>
en het werkt!!
Thanks so much Johan.
I guess that with this action setting first page is always Dashboard even if let’s say Orders are set as first page.
Perhaps just a note that I went with
`echo Mage::helper(’adminhtml’)->getUrl(’adminhtml’);`
as I set my admin link as something else and not admin therefore “admin/” doesn’t work.
So thanks again!!
jazkat
Plaats een reactie