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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Migrating a Site to Silverstripe /

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

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

Making old static site cohabiting with SS


Go to End


3 Posts   2982 Views

Avatar
Johnny

Community Member, 34 Posts

27 May 2009 at 5:16am

Edited: 27/05/2009 5:18am

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

Community Member, 11 Posts

10 June 2009 at 11:36pm

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

Community Member, 34 Posts

11 June 2009 at 3:17am

Thank you!