This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

Hi everybody,

after four days of trying, reading, stumbling through code, i think , i'll have to share something with you. It's a ton of text, sorry. But i hope, it'll be of some help for you.

Problem: Having a site, updated last in 2008, Google-Rank 7/10, 800+ real visits a day with "pure static html files".

What i wanted: Keep the "old" information, cause customers rely about our help, URLs and downloads. But even wanted to set up a "new" site with Concrete5 while our main business changed from hardware import / support to software development. So, "old" and "new" content needed to be available.

My experiences before: I felt in love with Concrete5 since 2010. We set it up for a lot of customers, but this time, it was a bit more tricky. So i read all the ideas in the forums here, but i got lost and got roughly 300 more gray hairs. Fortunately i know an Apache/mod-rewrite/PHP- Guru. So, this is my solution, i want to share with you (and it would be great, if some mod would put it in some tutorial section):

What i did: 1st step: We used our own compiler to create "static-html"-pages since +10 years. So i added a shiny red box above, that the displayed content is obsolete and only "2008-thingy".

2nd step: Also told the compiler, that the "index.html" is now "oldindex.html".

3rd step: FTPed this content up.

4th step: Installed Concrete5 in /concrete5.4.1.1

And NOW, the problems started. Because i didn't want to show .../concrete5.4.1.1/.... in the URL. If the page exist: Show it. If not: Use Concrete5!

Solution, step by step:

1st: This is the actual .htaccess:

DirectoryIndex index.html index.php
RewriteEngine On
RewriteBase /

RewriteRule ^$ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^concrete5.4.1.1/ [NC]
RewriteRule ^(.*)$ /concrete5.4.1.1/$1

This will redirect all "unknown"-Content (files or dirs) to Concrete5.

Next step, we need this .htaccess in the /concrete5.4.1.1-directory:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /concrete5.4.1.1/index.php/$1 [L]

Looks pretty "classic". Just use Concrete5 for everything. But, these two steps WON'T WORK!

You need to change the index.php in /concrete5.4.1.1 to

<?php
$_SERVER['REDIRECT_URL'] = str_replace('concrete5.4.1.1/', '', $_SERVER['REDIRECT_URL']); 
$_SERVER['ORIG_PATH_INFO'] = str_replace('concrete5.4.1.1/', '', $_SERVER['ORIG_PATH_INFO']);
$_SERVER['PATH_INFO'] = str_replace('concrete5.4.1.1/', '', $_SERVER['PATH_INFO']);
$_SERVER['SCRIPT_NAME'] = str_replace('concrete5.4.1.1/', '', $_SERVER['SCRIPT_NAME']);
require('concrete/dispatcher.php');

At this point, the dispatcher won't have any "/concrete5.4.1.1" stuff in the URLs / DIRs.

So, at the last step, we only have to change the /concrete5.4.1.1/config/site.php to:

<?php 
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'yourdbuser');
define('DB_PASSWORD', 'yourdbpw');
define('DB_DATABASE', 'yourdb');
define('BASE_URL', 'http://www.trisoft.de');
define('DIR_REL', '');
define('SERVER_PATH_VARIABLE','REDIRECT_URL');
define('PASSWORD_SALT', 'yoursalt');

All the "your..." thingys... just leave them untouched.

As you see by BASE_URL, my site is www.trisoft.de

And, here you can see the result:

www.trisoft.de/indexold.htm is working www.trisoft.de/en_indexold.htm is working

www.trisoft.de points to the "new" C5 site!

Well, i hope this will be of any help for you guys. Now, i'm going to look, how to keep the multilanguage-thingy...

Have fun with this Cookbook,

Mac

Loading Conversation