Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hey all,

Wasn't sure where else to put this post since there isn't a specific forum to ask for help. I saw people posting in General Discussion so I figured I'd give it a shot.

I've got a client site I built in Couch last year which worked great (http://mideastmedia.org/). This year they want basically the same thing but with minor tweaks for this current year. They want to preserve the previous year's pages and nest it under a folder named after the year number, 2014 in this case, basically starting 2015 from a clean slate with a new design and all that.

As far as URL structure, they are asking for something like this: <domain>/<year>/<section>/<page>
Right now I have: <domain>/<section>/<page>

Is there a way to move the current stuff under a "2014" folder and create a new "2015" folder with this year's content on it? I've been giving them new domains every year but that isn't an ideal solution for the long term obviously. So they want to put everything under one domain moving forward. I've been doing this since 2013, but 2014 was the first Couch-powered version. I don't need to move the 2013 stuff under Couch, so 2014's content is the only concern here.

Any help would be appreciated. Thanks!
Hi :)

From what I could gather, your client wants a new site at the current domain and would like to move the *entire* current site to a sub-domain http://yoursite.com/2014/.

I think the least 'invasive' way of doing this would be to create a physical folder named '2014' in your server's root and then migrate the current site (i.e. complete site including the 'couch' installation) into that folder.

To do so, first create a new database (say named 'db_2014') and then use the method described at http://www.couchcms.com/docs/miscellane ... erver.html for the migration. Make sure to specify the new database in the config file.

This way you'll have an exact replica of your existing site within the '2014' folder.

Now you can delete the current site (i.e. empty the database and delete all files including the 'couch' folder').

Create your new site as per usual (with its own 'couch' folder and database).

Does this help?

P.S. If you decide to go ahead with the method suggested in this post, I'd strongly advice to make sure you begin with taking a full backup of your site (specially the database) as the method involves working directly with the database - a safety net is always desirable.
Interesting approach. I didn't consider doing that. I wasn't sure how Couch would react to being placed in a sub-folder. I'll give it a shot in my development environment to see what happens. I'll let you know how it goes.

Thanks for the tip :)
Wow, that pretty much worked. I thought it would have freaked out being unable to find critical PHP files or something. I got it working properly with pretty URL's after a quick modification to the .htaccess file regarding the RewriteBase.

The only thing I'll have to do is go back through the templates and update the links to the javascript and css files, then go through the content and update any image locations. That won't be too bad.
I'm glad it helped :)

I got it working properly with pretty URL's after a quick modification to the .htaccess file regarding the RewriteBase.
I should really have mentioned the 'RewriteBase' setting in .htaccess - that is about the only thing that would need modification when moving a site into a sub-folder.

The only thing I'll have to do is go back through the templates and update the links to the javascript and css files, then go through the content and update any image locations.
Even this wouldn't have been necessary if your original links were like this -
<link href="<cms:show k_site_link />css/lightbox.css" rel="stylesheet" />
The <cms:show k_site_link /> would factor in the sub-folder.
Most of the links are set up that way but I'm talking about the links and image URL's in the editable regions of the site.

Still I think that could be doable by exporting the database as a SQL dump, and just doing a find/replace for the appropriate strings. A little hacky, but it would work.
Hi,

but I'm talking about the links and image URL's in the editable regions of the site
The editable regions of type 'image', 'thumbnail' and 'file' will adjust to the changed path as they don't store absolute paths internally. However, I agree, images inserted into text regions (specially 'richtext') will have this problem.

The easiest way to rectify the links would be to do a search-n-replace job on the file generated by gen_dump.php that you used for the migration. Of course, that would be before the migration is initiated - not relevant to your site as the migration is already complete.
7 posts Page 1 of 1