0
votes

I have moved a drupal website from live server to localhost, its URL on localhost is something like this : localhost/webname/docroot/

But the problem I am facing is that everything is broken. no css, no images only text is visible on pages.

On my live website when I click on login button a popup for login appears. But on local host its not working. I have tried using different login URLs but non of them worked for me.

Site on localhost is very slow as well.

Note : Here is a URL of one image : localhost/sites/default/files/Screen%20Shot%202015-02-24%20at%206.08.54%20PM_0.png

Similarly I have viewed source code of page and here are URLs of CSS and JavaScript files

localhost/sites/default/files/css/css_UCtZrZRD9npGm4D7o8VXPkl5qDJq-m8IlhuR9ccf_tY.css

localhost/sites/default/files/js/js_0gj6QcpfRH2jzTbCQqf7kEkm4MXY0UA_sRhwPc8jC1o.js

These images and files are not found in this location, is this a cache problem ? All these files and images are missing from this location : localhost/sites/default/files

2
Do you have login form on /user page? Do you see img tags in page source. What files are their hrefs targeting? Do you have files there? - MilanG
Here is a URL of one image : localhost/sites/default/files/… Similarly I have viewed source code of page and here are URLs of CSS and JavaScript files localhost/sites/default/files/css/… localhost/sites/default/files/js/… These images and files are not found in this location, is this a cache problem ? All these files and images are missing from this location : localhost/sites/default/files - user2740846
I think this is a cache problem,.js files should not exist in sites/default/files... ordinarly, have you tried clearing cache? - Shirin Abdolahi
As I am unable to login to admin so I tried clearing cache in phpmyadmin .. what else I can do ? - user2740846

2 Answers

0
votes

There is a great migration guide on drupal's website : https://www.drupal.org/node/776864

Also, for the speed of your website, there are two things to keep in mind :

  1. You local server might have different configurations and different hardwares
  2. You have to disable drupal_http_request_fails in your settings.php $conf['drupal_http_request_fails'] = FALSE; otherwise Drupal will try to connect to your localhost and the request will take some time to timeout which will slow your website.
0
votes

You've already mentioned your webroot is;

localhost/webname/docroot/

So it's unsurprising that your images don't resolve when they're attempting to be served from localhost/sites/default/files - they don't exist there, I assume they're in localhost/webname/docroot/sites/default/files?

You need to either set your vhost correctly, or edit your .htaccess file;

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal