5

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?

3

6 Answers 6

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:

 SELECT *
 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/*

OR

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

I hope this will help you.

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

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
2

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.

0

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

;extension=php_intl.dll

to

 extension=php_intl.dll
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.

mcrypt.

simplexml.

spl.

xsl.

intl.

mbstring.

ctype.

hash.

openssl.

zip.

xmlwriter.

gd.

iconv.

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.
0
  1. Rename your .htaccess.sample to .htaccess and try

or

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

In my case, I have to run the command:

bin/magento cache:flush 

to clean cache from Magento and other components And then I turn off the incognito window and reopen it again.

Your Answer

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

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