Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Migrating a Site to Silverstripe

What you need to know when migrating your existing site to SilverStripe.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Making old static site cohabiting with SS


Reply

3 Posts   1907 Views

Avatar
Johnny

27 May 2009 at 5:16am (Last edited: 27 May 2009 5:18am), Community Member, 34 Posts

Hi!

I want to include an old static site in a new SS site temporary, during the construction phase of the new SS site. What I want to do is something similar to that :

put the old site structure into a directory inside SS, something similar to 'old_site'. When receiving a request, SS checks if it's a SS url. If it's a SS url (ex: www.mysite.com/home/), then it serves that URL. If the URL doesn't exists, then it checks in the old_site directory to find its equivalent. If it doesn't find it, then the 404 error page comes up.

For example, if, in the old site, a had a link to www.mysite.com/event123/index.html, i would put everything in /old_site/event123/, so it would stay available.

Of course, i'd need to redirect / to /old_site/index.html the time the site is beeing constructed.

Is this possible?

Thanks in advance,

JP

Avatar
Radon

10 June 2009 at 11:36pm Community Member, 11 Posts

Use the same strategy as SilverStripe Static Publisher functionality. Solve it with Apaches mod_rewrite. Modify the .htaccess file (or the vhost if you prefer) to check for your static html files (this works if you have the complete site as static html). Check the apache mod_rewrite documentation to fit it to your needs (http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html):

# Static content
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{REQUEST_URI} /(.*)$
RewriteCond %{DOCUMENT_ROOT}/old_site/%1.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /old_site/%1.html [L]

Avatar
Johnny

11 June 2009 at 3:17am Community Member, 34 Posts

Thank you!