I have magento running in my localhost. But a trailing slash is not getting added to the URL. This causes javascript and css files to be not found and so the entire magento application is not running properly. Below are the URLs

<link rel="stylesheet" type="text/css" href="https://localhostskin/adminhtml/default/default/print.css" media="print">
<link rel="stylesheet" type="text/css" href="https://localhostskin/adminhtml/default/default/menu.css" media="screen, projection">
<script type="text/javascript" src="https://localhostjs/prototype/prototype.js"></script>
<script type="text/javascript" src="https://localhostjs/prototype/window.js"></script>

which are supposed to be

<link rel="stylesheet" type="text/css" href="https://localhost/skin/adminhtml/default/default/print.css" media="print">
<link rel="stylesheet" type="text/css" href="https://localhost/skin/adminhtml/default/default/menu.css" media="screen, projection">
<script type="text/javascript" src="https://localhost/js/prototype/prototype.js"></script>
<script type="text/javascript" src="https://localhost/js/prototype/window.js"></script>
  • show your coding file to get more info, where you have declared js file – Rakesh Jesadiya Oct 6 '16 at 8:45

You need to update your Base URL to http(s)://localhost/ in System >> Configuration >> Web >>

Since you are not able to load the admin itself, run below queries in your database:

UPDATE core_config_data SET `value` = 'http://localhost/' WHERE `path` LIKE 'web/unsecure/base_url';
UPDATE core_config_data SET `value` = 'https://localhost/' WHERE `path` LIKE 'web/secure/base_url'

Make sure you add necessary conditions scope and scope_id if you are running on multiwebsite

Also don't forget to flush your cache.

  • Yes, the URLs were like http://localhost and https://localhost before. Now I updated them to http://localhost/ and https://localhost/ in the core_config_data table. But still the slashes are missing after refreshing the home page. Do I need to run any indexing commands anywhere? – Baskaran N Oct 6 '16 at 9:12
  • No need to reindex. Just flush your magento cache (rm -r var/cache/*). Also check whether your media/skin/js urls in core_config_data have trailing slashes – Nidheesh Oct 6 '16 at 10:04
  • Yes i flushed the cache. Now its working fine. Thanks for your help!!. – Baskaran N Oct 6 '16 at 10:19
  • Please tick this as answer then, will be helpful for others – Nidheesh Oct 6 '16 at 10:55

Check the base url in system->configuration or in the database in the core_config_data table.
It should end with a slash (http://localhost/).
And a small tip, don't use localhost as a base url. It may not work on certain cases. Use instead.

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.