I installed Magento 2 (Dev RC) on an ubuntu instance on Google Conpute Engine. I changed the base url in the admin under stores > configuartion > web to a domain name.

It didn't work as I had hoped so I tried changing the base URL back to the original URL, which was http://IPaddress/magento2/, using phpmyadmin and changing core_config_data > web/unsecure/base_url

However, now when I try to access admin, all the css and js files are missing as the server is trying to load them using the old url.

I've looked in /var/cache and /var/session and can't find any files to remove.

Can anyone help? thanks

  • Thanks for the suggestions. I got so frustrated last night I deleted the instance and reinstalled Magento 2 from scratch. However, no doubt I will run into the same problems again, so I'll try your suggestions when I get stuck. Thanks again.
    – Gramoc
    Apr 17, 2015 at 9:33

3 Answers 3


Make a test.php file and upload in your server and run it. so clean your store and remove unwanted file and folder like var/cache...

## Function to set file permissions to 0644 and folder permissions to 0755

function AllDirChmod( $dir = "./", $dirModes = 0755, $fileModes = 0644 ){
   $d = new RecursiveDirectoryIterator( $dir );
   foreach( new RecursiveIteratorIterator( $d, 1 ) as $path ){
      if( $path->isDir() ) chmod( $path, $dirModes );
      else if( is_file( $path ) ) chmod( $path, $fileModes );

## Function to clean out the contents of specified directory

function cleandir($dir) {

    if ($handle = opendir($dir)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != '.' && $file != '..' && is_file($dir.'/'.$file)) {
                if (unlink($dir.'/'.$file)) { }
                else { echo $dir . '/' . $file . ' (file) NOT deleted!<br />'; }
            else if ($file != '.' && $file != '..' && is_dir($dir.'/'.$file)) {
                if (rmdir($dir.'/'.$file)) { }
                else { echo $dir . '/' . $file . ' (directory) NOT deleted!<br />'; }


function isDirEmpty($dir){
     return (($files = @scandir($dir)) && count($files) <= 2);

echo "----------------------- CLEANUP START -------------------------<br/>";
$start = (float) array_sum(explode(' ',microtime()));
echo "<br/>*************** SETTING PERMISSIONS ***************<br/>";
echo "Setting all folder permissions to 755<br/>";
echo "Setting all file permissions to 644<br/>";
AllDirChmod( "." );
echo "Setting pear permissions to 550<br/>";
chmod("pear", 550);

echo "<br/>****************** CLEARING CACHE ******************<br/>";

if (file_exists("var/cache")) {
    echo "Clearing var/cache<br/>";

if (file_exists("var/session")) {
    echo "Clearing var/session<br/>";

if (file_exists("var/minifycache")) {
    echo "Clearing var/minifycache<br/>";

if (file_exists("downloader/pearlib/cache")) {
    echo "Clearing downloader/pearlib/cache<br/>";

if (file_exists("downloader/pearlib/download")) {
    echo "Clearing downloader/pearlib/download<br/>";

if (file_exists("downloader/pearlib/pear.ini")) {
    echo "Removing downloader/pearlib/pear.ini<br/>";
    unlink ("downloader/pearlib/pear.ini");

echo "<br/>************** CHECKING FOR EXTENSIONS ***********<br/>";
If (!isDirEmpty("app/code/local/")) { 
    echo "-= WARNING =- Overrides or extensions exist in the app/code/local folder<br/>";
If (!isDirEmpty("app/code/community/")) { 
    echo "-= WARNING =- Overrides or extensions exist in the app/code/community folder<br/>";
$end = (float) array_sum(explode(' ',microtime()));
echo "<br/>------------------- CLEANUP COMPLETED in:". sprintf("%.4f", ($end-$start))." seconds ------------------<br/>";

Delete var folder from Magento root.

If still not working then rename app/etc/local.xml and hit url after this. Again rename old local.xml and delete newly created local.xml file.

  • yes , this also happen sometime. Apr 16, 2015 at 11:50
  • This is magento 2 not magento 1, you dont have local.xml anymore Jan 22, 2019 at 15:58

If you have enabled your Redis Cache (or any other external caching) system, then need to clear it manually. Yes using ssh command line.

I think, that's why you are not seeing any files in /var/cache folder.

If you are using Redis Cache System, then run this code in your ssh:

redis-cli flushall

Hope this will help.

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.