8

I have a situation where my client's admin url is something like this;

http://www.example.com/index.php/admin/admin/dashboard/index/key/0981a6bd2f5a06fec85d3c9e297849a0/

the word admin occurs twice, how to remove one. i checked app/etc/local.xml and in magento admin->system->configuration->admin, there was no changes in the default setting.

Note: I asked the same question on stackoverflow.com but didn't get any answer in 3 days, that's why i reposted it here.

  • 2
    By any chance, do you have the flag Use Store Codes in URL set to yes? – Marius Oct 24 '14 at 6:23
  • @Marius thanks for pointing out. Yes the flag was set to yes and i turned it to no, the problem is now gone. Please write it in answer so that i can accept it as true and also please if you can give a little more time to explain its uses. as my client was also not aware of that and asked me to check it. will it have any adverse effect on system's workflow after i disable it? as due to this problem some of extensions were not working properly. Thanks again for your help. – Haris Oct 24 '14 at 6:51
  • 1
    I've added my answer with some details about how it works. – Marius Oct 24 '14 at 7:07
14

The admin appears twice in the url when you have the flag Use Store Codes in URL set to Yes.
Since the admin section is a actually a store view from Magento's point of view, its code (admin) is shown in the url.
The second time it appears it's because admin is the route key for the adminhtml controllers.
For example, if you change the admin url key to backend from System->Configuration->Admin->Admin Base URL->Custom Admin Path, the url will look like http://example.com/admin/backend/controller/action/.
As for the extensions that are not working properly if you have the store codes in urls, it means they are badly written extensions. The extension behavior should work in both cases. Most probably they have hard-coded urls somewhere in the code.

  • Problem due to this url setting is that a tab in product management page is giving a 404 error. where the tab url is specified as ''url' => $this->getUrl('module_name/catalog_product/action_name', array('_current' => true)),' what would be the best way to do this? – Haris Oct 24 '14 at 9:19
  • 1
    @Saddam. I was right. This is a badly written extension. Admin url should be prefixed with admin not module_name. The solution is to broad to fit in here. It involves changing a lot of the extension's code. – Marius Oct 24 '14 at 9:21
4

Try this:

Check the values in /magentofolder/app/etc/local.xml and ensure all is good.
Log in and check the values at System > configuration > Web > Unsecure URL (and Secure URL) - make sure they are good (they should be, otherwise you’d not be able to log in very easily.
Go to System > configuration > Advanced > Admin and set the value of ‘use custom admin url’ to 'No' and remove any values, if any, in the URL box underneath it. Then save config.
If all these settings are correct, and you’re seeing admin/admin, then check:

System > Configuration > General > Web > URL options > Add store code to URL

There you must have set its value 'Yes'.

What this does is on the front end it includes the store code (actually store view code) to the URL for mutli-store setups, so that you can access a store like this : http://xyz.com/index.php/storecode1/ or http://xyz.com/index.php/storecode2/ ... etc.

But unfortunately it also does it for the admin (which has store code admin) - therefore, the path to your admin is now admin/admin - the first being the store code, the second being the path to serve the application. And so, some extensions that don’t use dynamic admin URL path won’t work - probably you’ll get a 404 where you expect your content to be in the main body of the page.

Enabling the second option in that admin (System > configuration > General > Web > URL options), i.e. "Redirect to Base URL if requested URL doesn’t match it" should fix all the problem.

If it still does not fix your problem then the last option to fix it to turn 'No' for 'Add Store Code to URLs' option.

  • Thank You Mohit for explaining it. but as @Marius has answered it first, that's why i accepted his answer as correct answer. – Haris Oct 24 '14 at 7:59

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.