Moving a Site

Permalink 5 users found helpful
Hi all,

I've noticed that many people aren't sure how to properly move their website, either from localhost to a live site, subdirectory to root, host to host or site to site within the same host.

I thought I'd consolidate what I've found so far and write a brief tutorial on my recent experience moving from one shared host to another. I'm not an expert by any means and feel free to make an comments or corrections on my directions.

If anyone has done this a lot, please let us know what's worked for you?

mario
View Replies: View Best Answer
mario replied on at Permalink Reply
mario
Instructions from Andrew:

- disable cache in debug area
- clear out cached files
- change the /config/site.php file as below

define('DIR_REL', '/new');

change it to:

define('DIR_REL', '/');

- backup entire www (root) folder into a folder called /old (for example)
- move over the entire C5 installation from /new to root folder

original posting:
http://www.concrete5.org/index.php?cID=4764...
mario replied on at Permalink Reply
mario
more specifics from Andrew:

1. Export and backup the database.
2. Transfer the files from the current server to the new server.
3. Modify config/site.php in this way:

Change BASE_URL to the new base domain of the new server
If the site is not at the root of the domain, change DIR_REL to be the path to the c5 install.

So, if you're site is athttp://www.mydomain.com/

you want BASE_URL = "http://www.mydomain.com"

and DIR_REL to be blank.

If your site is athttp://www.mydomain.com/c5/ you want it to say

BASE_URL =http://www.mydomain.com
DIR_REL = "/c5"

That's all you should have to do. Links should be automatically generated correctly to your updated domain.

original post:
http://www.concrete5.org/index.php?cID=4764...
mario replied on at Permalink Reply
mario
I'd setup a "fake" site on an unfamiliar host you're moving to ahead of time. Install C5 on it using the version you're transfering over, such as 3.5.1.1 and test it out to make sure things actually work as you expect such as pretty URL's, file uploads, etc.

Make sure that you backup your config folder files as soon as you get your first install initially setup. This will save you transfer headaches in the future since your site.php file contains your password hash which you need to make your passwords work. If that gets changed or deleted accidentally you're in trouble.

If installation is taking forever, double check that PHP 5 or higher is installed. For example, Media Temple has PHP 5 available to be activated but installs PHP 4 as default.

Anyways, "backup, backup, backup", including your files and packages. The time to plan for a transfer isn't when you need to but before you need to. It's great if you've backed up your DB, but do you really also want to have to recreate your entire files directory structure? Or go back and redo all your custom templates and fixes and themes? I'm guessing you don't want to. I sure don't.

P.S. i gave up on the tutorial since Andrew explains it better and I'm doing something funky and non-normal anyway.
jeremiah replied on at Permalink Reply
When I moved it to the root directory and made the change to DIR_REL to '/', I get a File not found when going to the root directory.
mario replied on at Permalink Reply
mario
Some instructions and code examples by Matt:

http://www.concrete5.org/index.php?cID=6127...

Remo has some nice code to change table header names from all lowercase to mixed case.
Remo replied on at Permalink Reply
Remo
It happens often if you move from Windows to Linux. The system cares about uppercase/lowercase quite suddenly (:

And then you have to rename the tables..
wendysandsheds replied on at Permalink Reply
If you have installed onto your local dev sever using Wamp, then try the following. It corrects the naming of the tables in the database.

Left-click the wamp gauge, then select Apache → Apache Modules → Rewrite Module. The gauge will flick to yellow, and then return to white.

Left-click the gauge, then select MySQL → my.ini. At the very bottom of the file, and add the following to a new line (without the quotes): “lower_case_table_names = 2”. Save the file, close Notepad and left-click the gauge, and selected ‘Restart all services’

Hope it helps others
mario replied on at Permalink Reply
mario
Instructions by Jotun:

- disable cache in debug area
- clear out cached files
- change the /config/site.php file as below

define('DIR_REL', '/new');

change it to:

define('DIR_REL', '/');

- backup entire www (root) folder into a folder called /old (for example)
- move over the entire C5 installation from /new to root folder

I think that's it, I will do this myself shortly. Let me know how you go.

original post:
http://www.concrete5.org/index.php?cID=10352...
daniela replied on at Permalink Reply
daniela
If you have pretty urls turned on, you gotta edit the .htaccess file to change the rewrite rule base. So in this example, if the site was originally set up in the /c5 off the site root, .htaccess would have this:
RewriteBase /c5/

which would need to change to:
RewriteBase /

or, of course, vice versa if you're moving from the site root to a subdirectory.
jeremiah replied on at Permalink Reply
When I moved it to the root directory and made the change to DIR_REL to '/', I get a File not found when going to the root directory.

***edit****

resolved this issue, I had to change

define('DIR_REL', '/');

to

define('DIR_REL', '');
Trav3lingMan replied on at Permalink Reply
What do I have to change to keep the concrete5 files in a sub-directory under the root dir, but still allow access via the root path?

Right now I have a test installation in /cr5-test and I'd like it to be live from the document root at / but still keep all the files (except index.php) in /cr5-test.

I've tried the various modifications listed here, but the stylesheet doesn't load and it starts the install process over again. Any thoughts?
Unitedpr replied on at Permalink Reply
I have mine in a sub-directory called /concrete5 and would like to keep it there and just move the index.php file. Have you had any luck in doing this? I still want to store other content in the root file in other directories so I can use the concrete site to hyperlink to certain files, etc. Let me know how this all turned out. I'll be trying to move the site in September.
Unitedpr replied on at Permalink Reply
I have my site under /concrete5.3.2 that's how it ended up when I installed it. Can't figure out how to change the folder name to just /concrete5. I mean I know how to change it but I'm afraid I'll break the website because of all the 5.3.2 references in all of the content files.
frz replied on at Permalink Reply
frz
update /config/site.php and it should be okay
Unitedpr replied on at Permalink Reply
Do I FTP into the site and rename the directory? Then update the /config/site.php file? You didn't really elaborate on this. And what about the index.php file? Do I drag it up to the root directory?
Mnkras replied on at Permalink Reply
Mnkras
in ftp rename thefolder to the name you want it to be, just that folder, then as franz said go /config/site.php

and change the DIR_REL from concrete5.3.2 to what you named the folder

BTW update to 5.3.3
Unitedpr replied on at Permalink Reply
OK. So go FTP into the site and rename the folder concrete5.3.2 to just concrete5. Then edit the DIR_REL to the new folder. You didn't mention what I need to do to the index.php file. If I remove all of the origiinal site files (old website residing in root folder) like index.html then when someone goes tohttp://www.mysite.com it will not find the index file. Don't I need to move the /concrete5.3.2/index.php file up one level to the root folder?
Mnkras replied on at Permalink Reply
Mnkras
yes ALL concrete files including ALL directories

im writing a step by step guide on how to do this right now
Mnkras replied on at Permalink Reply
Mnkras
HOW TO MOVE A SITE

1. Backup your databse, this is just incase something goes wrong but nothing should :)
2. Backup your file structure (the place you installed c5) this is also just incase something goes wrong

Ok now for the moving part.

3. Disable AND clear the cache.
4. Disable Pretty url's (you can re-enable later)
5. Move your c5 directory to where you want it to go, (the place where the index.php is)
6. Open the /config/site.php NOT the /concrete/config folder.
7. You will see something that looks like this:

<?php
define('DB_SERVER', 'mysql.yoursite.com');
define('DB_USERNAME', 'username');
define('DB_PASSWORD', 'pass');
define('DB_DATABASE', 'dbname');
define('BASE_URL', 'http://site.com');
define('DIR_REL', '');
define('PASSWORD_SALT', 'JKSD84KSFU94WJHFS984JS0F03JF0SJ3');
?>


there are 2 main lines we need to look at:

define('BASE_URL', 'http://site.com');
define('DIR_REL', '');


8. in the line: define('BASE_URL', 'http://site.com');

Where it says your site name e.g. concrete5.org. Change that you your new url so it would be like"

define('BASE_URL', 'http://url.concrete5.org.com');


make sure there are NO slashes in it!

if you are installing it in the root directory of a domain (like concrete5.org and NOT concrete5.org/url) then you are done Yipee!!!!

9. If not you got 1 more step,

If you lets say are moving from the c5 site from this url: concrete5.org/url
to this url:concrete5.org, this is what the line would look like:

define('DIR_REL', '/url');


to move it to the root directory just change it to:

define('DIR_REL', '');


if you are moving from concrete5.org/url to concrete5.org/url2 you would just change the /url to /url2

Thats it!

Mike/Mnkras

BTW i dont know why the url's have the extra stuff in the code boxes ignore it
mario replied on at Permalink Reply
mario
thanks for the comprehensive guide, Mike!
rantanplan41 replied on at Permalink Reply
Hi guys,

I have a situation: the database password had to be changed and now, even setting the new one in the site.php file, I still get no database connection... Does it have something to do with the PASSWORD_SALT stuff?

Thanks for your help.
Daniel
Unitedpr replied on at Permalink Reply
I understand I could just as easily move the whole site up one level (to the root) and not deal with renaming it. What I'd like to do is rename it from /concrete5.3.2 to just /concrete5 leaving it in a sub-directory off the root. But how does anybody know when surfing to the website know where it is when the index.php file resides in the sub-directory beneath the root. I have an existing site running in the root which has it's own index.html file. Eventually I need to erase that one and replace it with the one from concrete5. So don't I need to move it (index.php) up to the root but leave the rest of the concrete files in the sub-directory. Am I missing the boat on this one.
Mnkras replied on at Permalink Reply
Mnkras
if your c5 site is installed in site.com/concrete5
the index.php is in that directory when you move your site to site.com you move ALL the files INCLUDING the index.php
Unitedpr replied on at Permalink Reply
I'm not explaining myself right. I don't want to move ALL of the files to the root. I want to keep concrete5 in the sub-directory. So if someone surfs to mysite.com they will get a "404 error file not found" because the index.php file actually resides in the concrete5 sub-directory. I don't think browsers look into sub-directories to find index files do they? That being the case I think I need to move the index.php file (just one file) to the root but keep ALL of the other concrete5 files in the sub-directory. Does that make sense now?
aeroclown replied on at Permalink Reply
aeroclown
Is there a particular reason, if you are nuking your existing site that you do not want to move the whole concrete 5 installation to the root. I mean having the concrete install inside a subfolder a level off root is pretty useless unless you are putting something IN the root. You are still going to have to edit the site.php file any way you look at it regardless of where or how you move it. You should not be editing index.php, there is nothing in that file to edit, index.php pulls the relevant files relative to its location on the server. Thus is the reason you MUST edit site.php if you move the site from its original install location.
PF4Public replied on at Permalink Reply
My guess is that specifically written .htaccess rewrite rule would do the trick, or maybe somehow using symlink. I haven't tried this, so this is just an idea, because c5 exposes only one file: index.php, others are included, so, possibly modifying source - includes' and requires' pathes to be more specific - one could manage this.
Unitedpr replied on at Permalink Reply
I looked in my site. There is no /config/site.php the only one I could find is in the concrete5 folder.
aeroclown replied on at Permalink Reply
aeroclown
The folder you just named concrete5 is still the root of your concrete installation not the root of your server. When he says edit /config/site.php for you that means /concrete5/config/site.php and NOT /concrete5/concrete/config

However as I said earlier I don't see why you want to keep the install in a sub directory off the root if you want people to actually visit your concrete managed site by visiting the root of your site. unless you are putting something else in the root that loads concrete for you, you are just asking for a whole lot of headache.

That is why he said move EVERYTHING, because otherwise you are going to be in some kind of coding snafu trying to call concrete to the root from inside of a different directory. All of your relative paths are going to be fubar unless you do some extra work in index.php and site.php I suspect.
petertan77 replied on at Permalink Reply
I cleared and disabled cache. Copied entire test dir to root dir and change site.php to DIR_REL = ''; but still getting mysql errir. The test dir still works.

My second post on this problem. No one replied from the last one. Hope someone can help me here. Thanks!
mario replied on at Permalink Reply
mario
hi petertan,

I've run across this too.

ftp into your site and make sure that your File permissions for the files directory (and it's subfolders) are set to 777 or 775. 777 isn't quite as secure but is the better bet that it will work. You may only need to do the folder or file that's having issues but you may want to set the whole Files directory to that anyway. Don't set your entire site to 777 though or 775. Hope that helps!
Mnkras replied on at Permalink Best Answer Reply
Mnkras
Please refer to this tutorial on how to move a site,

http://www.concrete5.org/documentation/installation/moving_a_site...
ssnetinc replied on at Permalink Reply
ssnetinc
Just an update using version 5.6.2.1. I created a concrete site under a sub-folder /public_html/newsite. Whereas /public_html/ is the root folder for the domain.

Wanted to move up to root to make new site live. Hosting service uses cpanel so it was pretty easy. However, some of the instructions in this post are outdated due to version changes.

disable cache is no longer in debug area. It is under System & Settings > Optimization > Cache & Speed Settings. Turn off Block Cache and Overrides Cache.

Go back to Cache & Speed Settings and Clear the Cache.

I looked at the /config/site.php and it did NOT contain any code relative to DIR_REL - so I did NOT edit the site.php

Using cpanel, I created a new /public_html/oldsite folder and move all the old site files into the /oldsite folder.

Then I simply moved all the folders/files from under the /newsite/ folder up into the root /public_html/ folder.

Bingo - worked perfectly right off the bat.

As noted in related posts, make sure you turn off Pretty URLs under the SEO settings before doing the above because it does re-write your .htaccess file in the root folder. If you do all the above and site doesn't work - try looking at the .htaccess file and see if there may be old paths in there.