Concrete5 with invisible subdirs while keeping content
Permalink
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:
This will redirect all "unknown"-Content (files or dirs) to Concrete5.
Next step, we need this .htaccess in the /concrete5.4.1.1-directory:
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
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:
All the "your..." thingys... just leave them untouched.
As you see by BASE_URL, my site ishttp://www.trisoft.de
And, here you can see the result:
www.www.trisoft.de/indexold.htm... is working
www.www.trisoft.de/en_indexold.htm... is working
http://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
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:
All the "your..." thingys... just leave them untouched.
As you see by BASE_URL, my site ishttp://www.trisoft.de
And, here you can see the result:
www.www.trisoft.de/indexold.htm... is working
www.www.trisoft.de/en_indexold.htm... is working
http://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
+++ DELETED +++ EDIT WAS POSSIBLE ;-) +++
this is pretty cool! you should add this tohttp://www.concrete5.org/profile/howtos/post...
note though that for me the oldindex page gives a 404.
Hi 12345j,
YOU'RE JUST TOOOOOOOOOOOOOOOOOOO (NOTICE THE 'O's) QUICK!
I'm (in this second, seriously) uploading the "new" static
content.
And (in a few hours or so) there will be the "new, bright and shiny pretty normal website" live.
But, before i continue my work on the site, i just thought, it's a great idea to share my experience. Don't worry, just give me the night and tomorrow you'll see what i did IN YOUR BROWSER! Isn't that great?
Have fun using C5
Mac
YOU'RE JUST TOOOOOOOOOOOOOOOOOOO (NOTICE THE 'O's) QUICK!
I'm (in this second, seriously) uploading the "new" static
content.
And (in a few hours or so) there will be the "new, bright and shiny pretty normal website" live.
But, before i continue my work on the site, i just thought, it's a great idea to share my experience. Don't worry, just give me the night and tomorrow you'll see what i did IN YOUR BROWSER! Isn't that great?
Have fun using C5
Mac
I would, but i got an error:
"•Your how-to body cannot be empty."
And i don't have a chance to enter something at "details".
Could you give me a hint?
Or could some mod just copy'n'paste the thing?
"•Your how-to body cannot be empty."
And i don't have a chance to enter something at "details".
Could you give me a hint?
Or could some mod just copy'n'paste the thing?
Cool! Thanks for the write up!
I have yet to work with any archived sites, but this is useful.
Considering I don't know your entire situation, I might have taken a different approach.
I probably would have just created a c5 "Job" that crawled the archived site(s) and imported all the static HTML files into C5 pages. As for keeping the old URLs, I would have just appended ".html" to the page's Canonical URL and added an additional URL redirect that did not have ".html".
You could also just tell Apache to strip ".html" from all URLs rather than mess with the pages' Canonical URLs.
I have yet to work with any archived sites, but this is useful.
Considering I don't know your entire situation, I might have taken a different approach.
I probably would have just created a c5 "Job" that crawled the archived site(s) and imported all the static HTML files into C5 pages. As for keeping the old URLs, I would have just appended ".html" to the page's Canonical URL and added an additional URL redirect that did not have ".html".
You could also just tell Apache to strip ".html" from all URLs rather than mess with the pages' Canonical URLs.
ijessub,
you just don't know, how my (and i really mean MY) compiler works :-(
We're dinosaurs here. In business since 1979, and i started the compiler thingy around 1999-2000 (no really useful CMS around this time).
Importing static content? I would be really interested, but i don't have a clue how to do this?
Could you share an idea or a link?
Acshually we had some thing on our local PC. With a "Makro"-File, tons of "html-Files", and the "Compiler" is a very complex "replacement and create a menu thingy".
Anyhow, my main point was to freeze the actual thing, keep the content and URLs while adding some new information. Cause it just sucks, if you announce the 2008 x-mas-bundle in 2011 ;-)
Also we have a ton of really impressive projects, but never had the time (ok, and also nobody wanted to mess with the old stuff) to update our website.
you just don't know, how my (and i really mean MY) compiler works :-(
We're dinosaurs here. In business since 1979, and i started the compiler thingy around 1999-2000 (no really useful CMS around this time).
Importing static content? I would be really interested, but i don't have a clue how to do this?
Could you share an idea or a link?
Acshually we had some thing on our local PC. With a "Makro"-File, tons of "html-Files", and the "Compiler" is a very complex "replacement and create a menu thingy".
Anyhow, my main point was to freeze the actual thing, keep the content and URLs while adding some new information. Cause it just sucks, if you announce the 2008 x-mas-bundle in 2011 ;-)
Also we have a ton of really impressive projects, but never had the time (ok, and also nobody wanted to mess with the old stuff) to update our website.
Basically, you'd write a script that goes through all the files, pulls the contents of each file, scrapes out the relevant information into a variable (or rather discard irrelevant data like menus, etc), programatically create a new c5 page and either add a content block, or even an HTML block, using the previously created variable as the value of the block's content.
Hmmmm. K'
But, why should i write a script, invest time and stuff?
The "old content" already exists. Will be never changed again.
So, my approach was, JUST KEEP IT.
Everything else will be handled through Concrete5.
But, why should i write a script, invest time and stuff?
The "old content" already exists. Will be never changed again.
So, my approach was, JUST KEEP IT.
Everything else will be handled through Concrete5.
I'm not saying do that now. You already have your solution.
I'm just saying, I would have taken a different approach. This way, menus, headers, footers, etc. would remain consistent (or rather dynamic) throughout the site as updates are made. Again, I don't really know much about your situation, so my solution might not be the best.
I'm just saying, I would have taken a different approach. This way, menus, headers, footers, etc. would remain consistent (or rather dynamic) throughout the site as updates are made. Again, I don't really know much about your situation, so my solution might not be the best.
Ok, but why investing time and money into existing static stuff?
The "old content" is fine. So i just wanted to keep it and do all the bright and shiny new things with C5.
But, i guess, that's something "religous discussion". So we're both right ;-)
The "old content" is fine. So i just wanted to keep it and do all the bright and shiny new things with C5.
But, i guess, that's something "religous discussion". So we're both right ;-)
This is really helpful, thanks!
Too bad index.php has to be changed; would be nice if concrete5 supported this type of thing directly.
Too bad index.php has to be changed; would be nice if concrete5 supported this type of thing directly.