James Crook, web geek ++

Creating a static version of a dynamic site

28 Feb 2011

VIM screenshot

I recently needed to create a static version of a dynamic ColdFusion site.

The client no longer needed access to the legacy ColdFusion CMS running the website but wanted to retain access for the public while moving the site to the server that runs their other (PHP) websites. I didn't make the CF site but the client wanted me to make the static version.

Tricky, but I found a method that works well.

I started by downloading their entire site as rendered html using wget:

wget -r website.com

The resulting files were saved with question marks and ampersands in the filenames, but when put on a server these are interpreted as query strings and as our new server doesn't interpret .cfm files it results in the raw code being loaded. So we can't leave the filenames that way.

'Rename' is a handy utility that works with regex to rename files. I used it here to remove the query-strings and add a .html extension. You could do further renaming to remove spaces and other special characters if you needed to. Basically it works like rename -v 's/search/replace/' [files]

rename -v 's/\.cfm\?(.*)/_cfm_$1\.html/' *.cfm*

Once the filenames are change we need to make make the internal links keep working, without having to edit every file to change where the links point. I chose to do some .htaccess voodoo so that when a page is requested with a .cfm?querystring extension it finds the correct, renamed, file.

In .htaccess, I worked out he following code that loads the new file from a link to the old:

Options +FollowSymlinks RewriteEngine on RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^index\.cfm$ http://website.com/index_cfm_%1.html? [R=301]

The RewriteCond is needed because otherwise .htaccess disregards the query string.

This particular project still needed a bit of manual editing of some site areas where the links were absolute, but I think that the above solution will work in most simple cases.

 

Categories: 

Comments

31 Mar 2013

altefalcope <a href="http://vikawieier.com">xaikalitag</a> Nupestemype http://uillumaror.com - iziananatt Gymnsypeshy http://gusannghor.com Icercefaree

11 Mar 2014

If like me you're trying to learn a brand-new
language thsn anything that makes tthe procedure simpler has obtained to be an excellent point.
I have actually looked at numerous of the defices offered andd have actually uncovered to
mmy price that many of the paid ones are very considerably ineffective.

02 May 2014

My spouse and I stumbled over here from a different website and thought I may as well check
things out. I like what I see so now i am following
you. Look forward to looking into your web page repeatedly.

22 Jun 2014

I all the time used to study post in news papers
but now as I am a user of web so from now I am using net for articles or reviews, thanks to web.

23 Jun 2014

My spouse and I absolutely love your blog and find the majority of your post's to
be just what I'm looking for. Does one offer guest writers to write content for
you? I wouldn't mind writing a post or elaborating
on a number of the subjects you write in relation to here.
Again, awesome site!

26 Jun 2014

Hi, just wanted to say, I loved this post. It was inspiring.
Keep on posting!

22 Jul 2014

2. You have two options in choosing your desired number combination.
First would be to manually pick the numbers you have significant attachment with and second, to automatically select number combinations if you use lottery software.
Many regular lotto players who wondered about how precisely to win the lottery guaranteed have taken on using lottery software predetermined the
quantity combinations with higher probability of winning.
Lottery software gets the capacity for keeping tracks of previous draw results.

From that, comparison and combinations are made through unique algorithms that
eventually generate the winning numbers.

15 Aug 2014

It's very straighhtforward to find out any matter on neet
as compated to books, as I found this article
at this wweb page.

28 Jun 2014

Does your blog have a contact page? I'm having problems locating it but,
I'd like to send you an email. I've got some suggestions for your blog you
might be interested in hearing. Either way, great
blog and I look forward to seeing it expand over time.

20 Jul 2014

Howdy! This post could not be written any better! Reading this post reminds me of my old room mate!
He always kept talking about this. I will forward this post to him.
Pretty sure he will have a good read. Many thanks for sharing!

12 Aug 2014

I am really enjoying the theme/design of your blog. Do
you ever run into any browser compatibility issues? A number of my blog audience have complained
about my site not operating correctly in Explorer but looks
great in Firefox. Do you have any advice to help fix this problem?

20 Aug 2014

Thanks for finally talking about >Add new comment | JmsCrk <Liked it!

09 Jul 2014

And the patient is not medical attorney part of the shock, the experience.
Before hiring a medical malpractice case. So why do I
share with you because this happens all the way. The following
are my suggestions for any physical injuries?
She couldn't do it at set times and if there is no single known cause of death for your loved one's injuries.

13 Jul 2014

Great post! We will be linking to this particularly great content on our website.
Keep up the good writing.

21 Jul 2014

Thise suffering from kidney disease, going through dialysis
or who are believed to have kidney damage may need to
have thiis test performed. Myonox supplement produces minimum
power output, keeps the mind and muscles alert, increases focus as well as maintaining the pump.
Glomerular filtration rate is a measure of how well the
kidneys are functioning.

26 Jul 2014

I'm not sure exactly why but this website is loading incredibly slow for me.
Is anyone else having this issue or is it a problem on my end?
I'll check back later on and see if the problem still exists.

19 Aug 2014

I drop a leave a response whenever I appreciate a post on a
website or I have something to contribute to the conversation. It's triggered by the sincerness displayed in the post I browsed.
And after this post Add new comment | JmsCrk.
I was moved enough to post a thought :-P I do have a couple of questions
for you if you don't mind. Is it only me or do a few of the remarks appear as if they are written by brain dead visitors?

:-P And, if you are writing on other online sites, I would like to keep up with you.
Could you make a list every one of all your public sites like your linkedin profile, Facebook page or twitter feed?

17 Aug 2014

Does yolur blog have a contact page? I'm having a tough
time locating it but, I'd like to send you aan email.

I've got some creativ ideas for your blog you might be interested in hearing.
Either way, great site and I look forward tto seeing it grow over time.

28 Aug 2014

Greetіngs! I know this is kinmda off topic Ьut I ԝaѕ wondering ԝhich blog platform ɑre you սsing for tthis website?
Ι'm ggetting sick ɑnd tired of Wordpress Ƅecause І've hаd problems with hackers andd I'm lօoking aat alternatives fοr
anotҺeг platform. I would bbe ǥreat if you coulɗ pօint me in the
direction of a goߋd platform.

26 Jun 2014

Hey there, You have done a great job. I will certainly digg
it and personally recommend to my friends. I'm sure
they'll be benefited from this site.

29 Jun 2014

Hi mates, nice piece of writing and pleasant urging commented here,
I am really enjoying by these.

26 Jul 2014

Hello, i think that i saw you visited my site so i came
to “return the favor”.I'm attempting to find things to enhance my site!I suppose
its ok to use a few of your ideas!!

27 Aug 2014

Hello Dear, are you actually visiting this website regularly, if so after that you will absolutely take nice
know-how.

14 Jul 2014

Very good info. Lucky me I recently found your website by accident (stumbleupon).

I've saved as a favorite for later!

13 Aug 2014

Hello to all, how is all, I think every one is getting more from tyis web page, and your views are
ggood in support of new viewers.

16 Jun 2014

continuously i used to read smaller posts that as well clear their motive, and that is also happening with
this post which I am reading at this place.

23 Jun 2014

It's in point of fact a great and helpful piece of info.
I am glad that you shared this helpful information with us.
Please stay us informed like this. Thanks for sharing.

18 Jun 2014

Since the admin of this web site is working, no question very soon it will be famous, due to its feature contents.

22 Jun 2014

Definitely believe that which you stated. Your favorite
reason seemed to be on the web the easiest thing to be aware of.
I say to you, I certainly get irked while people think about worries that they plainly don't know about.
You managed to hit the nail upon the top and also defined out the whole thing without having
side-effects , people can take a signal. Will likely be back to get more.
Thanks

23 Jun 2014

WOW just what I was looking for. Came here by searching for

23 Jun 2014

Hi there i am kavin, its my first time to commenting anyplace, when i read this post i thought i could also make comment due to this
sensible piece of writing.

23 Jun 2014

Neat blog! Is your theme custom made or did
you download it from somewhere? A design like yours with a few simple
adjustements would really make my blog stand out. Please let me
know where you got your design. Appreciate it

24 Jun 2014

Hi would you mind stating which blog platform you're using?
I'm planning to start my own blog in the near future but I'm having a tough time choosing
between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your design and style seems different then most blogs and
I'm looking for something completely unique.
P.S My apologies for being off-topic but I had to ask!

14 Jul 2014

Hi i am kavin, its my first occasion to commenting anywhere, when i read this piece of writing i
thought i could also create comment due to this sensible piece of writing.

27 Aug 2014

Aw, this was an exceptionally nice post. Taking a few minutes and actual effort to produce a really good article… but whst can I say…
I procrastinate a lot andd don't seem to get nearly anything
done.

25 Jun 2014

Every weekend i used to pay a visit this website, because i wish for enjoyment, for the
reason that this this site conations in fact good funny stuff too.

01 Jul 2014

I absolutely love your blog.. Great colors
& theme. Did you build this web site yourself?
Please reply back as I'm looking to create my very own website and want to find out where you got this from or just
what the theme is called. Cheers!

22 Jun 2014

Why people still use to read news papers when in this technological world everything is accessible on web?

24 Jun 2014

Greetings from Carolina! I'm bored at work so I decided to check out your site
on my iphone during lunch break. I enjoy the information you provide here and can't wait to take a
look when I get home. I'm amazed at how fast your blog loaded on my cell phone ..

I'm not even using WIFI, just 3G .. Anyways, amazing blog!

13 Aug 2014

Great post. I was checking constantly this blog and I am impressed!
Very useful information specifically the last part :) I care for such info a lot.
I was seeking this certain info for a long time. Thank you and good
luck.

22 Jun 2014

whoah this weblog is excellent i like studying your articles.

Keep up the great work! You realize, many persons
are looking round for this information, you can help them greatly.

23 Jun 2014

Thank you a lot for sharing this with all folks you really recognize what you're talking about!
Bookmarked. Kindly additionally discuss with my web site
=). We may have a hyperlink exchange arrangement among us

24 Jun 2014

Right away I am ready to do my breakfast, later than having
my breakfast coming again to read further news.

25 Jun 2014

Hello There. I discovered your weblog using msn. This is a very smartly written article.
I will make sure to bookmark it and come back to
read extra of your helpful info. Thanks for the post. I'll certainly return.

01 Jul 2014

If you desire to take a good deal from this paragraph then you have to apply these strategies to your won blog.

25 Jul 2014

I don't even know how I stopped up here, but I believed this submit was once good.
I don't realize who you might be however certainly you're going to a well-known blogger when you
are not already. Cheers!

25 Aug 2014

Eveey weekeend i used to go to see this web site, as i wish
for enjoyment, as thios this web page conations genuinely nice funny stuff too.

03 Jul 2014

Superb website you have here but I was curious about if you knew of any
user discussion forums that cover the same topics talked about here?
I'd really like to be a part of community where I can get advice from other knowledgeable individuals that share the same
interest. If you have any suggestions, please let me know.

Bless you!

21 Jul 2014

It is the best time to make a few plans for the long run and it is time to be
happy. I've read this submit and if I could I desire to counsel you few interesting issues or tips.
Perhaps you can write subsequent articles regarding this article.
I want to learn more issues approximately it!

22 Jun 2014

Good way of describing, and good post to obtain information concerning my
presentation topic, which i am going to deliver in academy.

Pages

Add new comment