I uploaded my magento 2 website from localhost (xampp) to server.

I changed base url in database table but it is still redirecting to same localhost (both section frontend and admin).

Is there a problem with the cache? If yes, then how do I clear the cache on server?


5 Answers 5


moving files and database

I assume these two steps are obvious:

copy all of your local files to production server

dump your magento local db and import it into your production server db

editing in production server

now on your production server you need to follow these two steps:

edit app/etc/local.xml file and change database info

in production db,in its core_config_data table, you should find every records containing the url of your local installation, then you need to update those values;which can be found with this query:

 FROM `core_config_data`
 WHERE `value` LIKE 'http://example.com';

edit (thanks to comments):

  1. Do not forget to delete var folder contents

  2. it'd better if you remove the content of app/etc/use_cache.ser too

you can clear cache by

go to cpanel

cpanel > filemanager > public_html > var > cache

select all cache

delete all

other way is

Through the Magento Admin Panel

Log in to your Admin Panel account Go to the System -> Cache Management section Click on the Flush Magento Cache button

Using SSH/FTP or the cPanel File Manager

Delete the contents of the var/cache/ folder using the following SSH command (MUST be executed from your Magento base directory):

rm -rf var/cache/*


Delete the folder var/cache/ through your FTP client or using the cPanel File Manager.

I hope this will help you.

  • Already removed all files but still redirecting. it is magento 2 project. Jan 5, 2016 at 11:08
  • are you sure you change both url in core_config_data for secure and non-secure??? Jan 5, 2016 at 11:10
  • yes.. I have already updated. Jan 5, 2016 at 11:11
  • clear all cache and sessions. and clear browser history also. Jan 5, 2016 at 11:12
  • update local.xml for database also. Jan 5, 2016 at 11:13

update values using built-in console commands (substitute your domain name):

php bin/magento setup:store-config:set --base-url="http://awesome-domain.dot/"

php bin/magento setup:store-config:set --base-url-secure="https://awesome-dom.dot/"

php bin/magento cache:flush

It seems Magento 2 has a default hostname "localhost" somewhere. Normally you should be able to run Magento 2 without setting the Base URL. But I've just encountered various instances (Magento 2.0.4) that suddenly redirected to localhost. The solution was to edit the core_config_data table directly and insert a new web/unsecure/base_url and web/secure/base_url with the correct URL set. After installing Magento 2, the Admin Panel should give you a message repeatedly as well.


Just need to clear comment before this line in php.ini file:



for your problem 

Fatal error: Class 'IntlDateFormatter' not found in /home/energys5/public_html/website-design-perth.com.au/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 107

please check first following php extension on your sever curl. dom.














and PHP 5.5.x and greater versions

MySQL 5.6.x and greater versions and file permissions

 "{"path":"directorypath/app/etc"}"   writable directory permission.

"{"path":"directorypat/var"}" writable directory permission.

"{"path":"directorypath/pub/media"}" writable directory permission.

"{"path":"directorypath/pub/static"}" writable directory permission.
  1. Rename your .htaccess.sample to .htaccess and try


  1. You can put your demo magento2 .htaccess file and try.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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