I tried to find the answer to this problem - but had no luck finding it yet.
I moved a site to my localhost for further development. All is working fine - just the images are not showing up.
I know it is a (relative) path problem- but how to solve it??
I am using WAmp Server & Drupal 6.10.
The path on the web is http://www.example.net/....
The path on Wamp is http://localhost/testing/....
My images are on the basic, relative Drupal path /sites/default/files/myimages/
For example image1.gif is under /sites/default/files/myimages/image1.gif.
This works fine on the remote hosted server. But on my localhost set-up the images do not show.
When I add the localhost directory of /testing to the path like this /testing/sites/default/files/myimages/image1.gif - the images show up.
It would be tedious to change all the path settings for all the images page by page. What I need is a simple general solution without changing every page individually.
Is there a simple way to set this path somewhere in general for the entire localhost installation? Because, when I move the lot back to the hosted server I need the relative path of basic Drupal in tact.
Thanks for any suggestions -
Comments
Just read the settings.php
Just read the settings.php file about mulitsites and everything will become clear. Ignore for a minute the phrasing - multi-sites and just concentrate on what you're trying to achieve... Accessing Drupal away from its root (i.e. localhost will work fine, but you're after using localhost/testing...) so instead of using sites/default use - sites/localhost.testing (or something like that, read the file comments for clarification). Reason being is that Drupal will then add in the extra 'directory' to paths through its API, you then gain that 'base directory'.
Pobster
Just read the settings.php
Hi Pobster,
I really appreciate your help and just spend quite a bit of time searching around for mulitsites info on Drupal.org. (http://drupal.org/node/43816 - Beyond the basics >> HowTos >> Multi-site installation and set-up plus various searches).
I experimented with various settings in the settings.php and with directories on the local set-up. But I am nowhere near a solution.
Could you just point out the paragraph in settings.php I need to understand. In my settings.php there is not the term "mulitsites".
Do I need to make changes to .htaccess as well?
Thanks
My settings.php file:
It's not so much about what's
It's not so much about what's in the settings.php file as more where you have it? Read the blurb right at the top;
And no, leave the .htaccess file exactly as it is (and probably the base_url setting as well).
Pobster
hi there - does it have to do
hi there - does it have to do with the settings -
well i also am not able to upload images
can this be rootet in the settings.php
any solution on this yet ?
hello, tryitonce did you get this resolved ? having the same problem of image not showing up after moving to localhost. All pages are working fine though. I checked the url of the images. they were wrong everywhere. Apparently, the subfolder is not getting added to http://localhost in my image filepaths.
i.e., it shows up as http://localhost/sites/all/themes/dummyname/images/imagefile.jpg
when it should have been,
http://localhost/subfolder/sites/all/themes/dummyname/images/imagefile.jpg
how do I get drupal to update the file path properly for all the images ? Any help would be appreciated.
Thanks
_
No, I didn't resolve it. I just know the images are there and the localhost is now just used for testing and I do not transfer back to the server.
Yes, it would be good to resolve this - but right now I won't have time to look at this again. Should you have some more ideas let's keep exchanging them here and hopefully in time we will find the answer.
Good luck ....
I found a way around this, a
I found a way around this, a temporary solution....
Theres an error, in spite of setting my base url to
localhost/mysite
after importing on Localhost my images
were still not loading like your case.
When i checked path everything was alright.Then i thought it was a permissions issue
spent a day trying to work my way around the permissions issue but that wasn't the case.
The image files had right paths but the base url was not working so the image files were pointing to
localhost/sites/default/files/image.jpg
instead of
localhost/mysite/sites/default/files/image.jpg
Tried to get this error fixed but couldnt find any solution
Finally since i didnt want to re edit all my image links again i just
copied the folder sites/default/files/image.jpg on the localhost htdocs..
Now all my images are loading fine..At least this servers as a temporary solution..
If you do find a solution to this problem do keep us posted
File System settings
Not sure if this is the same problem, but I just changed domain names (on a multi-site install). I thought that changing the base_URL in settings.php and the directory name would do the trick.
It did -- in that I could get to the site, but no images (and missing theme components too).
I found that my File System image path (in Configuration) was set to the old domain name. When I fixed that, the images showed up.
DAMP localhost
I was struggling with this issue for weeks with WAMP, fortunately someone informed me about DAMP (amp stack especially for Drupal!).
http://acquia.com/documentation/acquia-drupal-stack
Easy to set up, works fine for me. All links work, I am able to use Backup/Migrate module to import/export between development and live sites.
DAMP comes with an Acquia Drupal distribution, but you don't have to use it.
Follow these instructions on importing an existing site to local
http://acquia.com/documentation/acquia-drupal-stack/import
Good luck!
nathan
_
Thanks - will try soon
I had a similar problem but
I had a similar problem but on LAMP -using Linux as an OS.
It turns out that when Drupal renders images inserted in blog post, it doesn't use the relative path to the Drupal installation but to the server itself. I was able to fix the missing pictures by changing the configuration in the Apache file server. I pointed the document root to the Drupal installation directory. Granted this is not hte perfect solutions for those with multiple Drupal installs, but it helps if you only need to replicate one site.
$base_url = "http://www.example.com";
Have you tried setting the $base_url in settings.php to match the address of your Drupal site:
$base_url = "http://localhost/testing/othersubdirectory";
Make sure you clear the cache after this change.
Working
I just changed my URL and site is working fine. Thank You
Tried advice but no luck yet
I was trying to set up WAMP today. I copied the database and files from a remote server to my local PC, into a subdirectory "C:\wamp\www\mysite". When I did this, everything worked fine except for the urls for images, which are "/sites/default/files/image.jpg" instead of the needed "/mysite/sites/default/files/image.jpg"
I edited "mysite\sites\default\" to "mysite\sites\localhost.mysite" thinking that perhaps the multisite mechanism would generate the proper image urls needed. I also edited settings.php to include "$base_url = 'http://localhost/mysite';"
The first time I did the rename of default, Drupal ran install.php instead of loading the site so somehow it didn't recognize the folder within "sites". I tried to undo it, and redo it and clear cache, but the theme wasn't loading properly (I am using a subtheme of Sky). I changed the theme to Bartik, and the theme loaded but Drupal was still not generating the needed urls for the images.
So no matter what of the above advice I follow, I still don't get the images to load.
We must find thw solution!
I hope that it just in wamp and not will happend when import the web site to another domain / hosting server!
virtualhost
I got this to work by setting up a virtualhost in WAMP. You configure apache to support virtual hosts, and then create a few configuration files, and it works. See http://blog.jlbn.net/?p=23 for details.
use a symbolic link
I struggled with a similar (same?) problem, which I solved in Linux by creating a symbolic link thus:
root@testhost:/var/www/drupal/sites# ln -s example.com testsite
root@testhost:/var/www/drupal/sites# ls
example.com all default testsite
example.com is the name of your original live site. Drupal goes looking for a lot of files relative to this directory. By simply adding a symlink you fool Drupal into doing the right thing.
IMHO all files should be relative to the files/ directory, but apparently they aren't.
I'm assuming you can do the same thing in Windows, but thankfully I don't have to worry about that :)
This solution worked for me
Upon importing my database to a testsite many images were not displaying.
Days ago I read on a post somewhere that the .htaccess file of the testsite was the culprit.
The post advised that the following lines of the file required a comment (#):
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
For security reasons, Option followsymlinks cannot be overridden.
Options +FollowSymLinks
like so.....
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
#Options None
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks
Be aware though that there are 2 .htaccess files (which I have only now just discovered)....
1. /testsite (or whatever your directory is called)
2. /testsite(or whatever your directory is called)/sites/default/files
Both need to be commented to get all images to display.
Oh yes, I also changed the base url to that of my testsite in the settings.php file.
Hope this saves someone hours of grief!!
thanks
just uncommenting #RewriteBase / then flushing the cache worked for me.
/chris
I found solution that worked for me.
I have deleted what inside /files/.htaccess and flush cache everything worked fine. Images are loading properly.
I mean leave .htaccess file empty in /files folder.
Cheers ~~~
It works
Thank you!