By SamD on
I have read the posts on moving a Drupal installation from one server to another. This is not what I need to do. I have a site set up and running on a server. We wanted to change the site over to Drupal, but wanted to test out some features first. We installed Drupl in it's own directory and created the new site. Now we want to move the newly created site from the subdirectory to the main directory. The old site has been removed. If we just move the files to the main directory, most of the images and links do not work ... as would be expected. Is there a way to move Drupal from a subdirectory to the main directory? Or is the site going to have to be rebuilt form scratch?
--> Sam D
Comments
No, I am sure it can be
No, I am sure it can be moved. But
- Was it accessed as a subdomain (test.example.com) or directly with the subdirectory path (example.com/test)?
- What was your "file system path" in /admin/settings? Was your downloads method "public" or "private"?
These answers may matter.
- it would be a subdirectory
- it would be a subdirectory path (example.com/test)
- file system path is just "files"
- Downloads method is set to "public"
- If needed Temporay directory is"/tmp"
--> Sam D
"files" was a path relative
"files" was a path relative to your Drupal installation.
Drupal was in example.com/test
So, your pictures and files were stored under "example.com/test/files" and they will be moved under "example.com/files"
Normally it should work. The database should have stored their relative paths and everything should be ok after the move as it is, at least the way the upload module works...
You said "most of the images and links do not work". Some do? I suspect that a misbehaving module has hardcoded your "/test" path into the file links in the database. Or there are URLs manually added to the content, containing the "/test" path.
So (after making sure that you have a backup) could you search the database for "test/files" and replace it with "files" everywhere?
Or even better, replace only one instance first, clear the 'cache' table, check what happens, and then go on.
------
*** Edited to add: "test" was my example path. Just to be sure.
settings.php
You would need to check the configuration file for your drupal site.
If this is the only site you have this is probably in /sites/default/settings.php
Check to ensure you haven't got an absolute base path in there that might be confusing things.
from the file:
/**
* Base URL (optional).
*
* If you are experiencing issues with different site domains,
* uncomment the Base URL statement below (remove the leading hash sign)
* and fill in the URL to your Drupal installation.
*
* You might also want to force users to use a given domain.
* See the .htaccess file for more information.
*
* Examples:
* $base_url = 'http://www.example.com';
* $base_url = 'http://www.example.com:8888';
* $base_url = 'http://www.example.com/drupal';
* $base_url = 'https://www.example.com:8888/drupal';
*
* It is not allowed to have a trailing slash; Drupal will add it
* for you.
*/
# $base_url = 'http://www.example.com'; // NO trailing slash!
Ah, yes! Make sure that your
Ah, yes! Make sure that your settings.php file is in "sites/default/" and that the "$base_url" line is commented out with the "#" in front.
OK my settings.php file has
OK my settings.php file has the following line:
$base_url = 'http://mvobservatory.com/drupal
Should I edit out the /drupal part when moving to the main directory?
Should I also add "#" to the front or leave it as is?
Thanks for the helpp guys.
--> Sam D
Yes, either (or both) will
Yes, either (or both) will work.
$base_url = 'http://mvobservatory.com'; (without a trailing slash) will make this line right.
The # in front will cancel this line completely -- it was not really needed anyway.
I hope that that was it and that you are done.