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.




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.

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!

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.

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!!

14 Jul 2014

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

I've saved as a favorite for later!

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.

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.

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!

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!

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.

23 Jun 2014

Excellent post but I was wanting to know if you
could write a litte more on this subject? I'd be very thankful
if you could elaborate a little bit more. Many thanks!

26 Jun 2014

Magnificent website. Plenty of useful info here. I'm sending
it to several friends ans also sharing in delicious. And certainly,
thank you on your effort!

29 Jun 2014

I couldn't refrain from commenting. Very well written!

12 Jul 2014

If you are impatient and do not want to wait until you beat the
songs to unlock more you can cheat and download Masters mode from Xbox live for free.
If you already have an existing account, like my
husband and I did, you can add it to the Family Pack with no problems.
Tom Clancy's ghost recon can be a thrilling collection of military tactical shooter
online video online game.

23 Jun 2014

I know this if off topic but I'm looking into starting my own blog and was wondering what all is
required to get set up? I'm assuming having
a blog like yours would cost a pretty penny? I'm not very internet
smart so I'm not 100% sure. Any suggestions or advice would be greatly
appreciated. Many thanks

29 Jun 2014

What a stuff of un-ambiguity and preserveness of precious knowledge
on the topic of unpredicted feelings.

10 Jun 2014

This piece of writing presents clear idea in support
of the new people of blogging, that in fact how to do running a

22 Jun 2014

Very good information. Lucky me I found your blog by accident (stumbleupon).

I have saved as a favorite for later!

22 Jun 2014

It's in fact very complicated in this active life to listen news on TV,
thus I just use the web for that purpose, and obtain the newest news.

23 Jun 2014

Hurrah! Finally I got a webpage from where I know how to
in fact obtain helpful data concerning my study and knowledge.

24 Jun 2014

I rarely comment, but i did some searching and wound up
here Add new comment | JmsCrk. And I do have 2 questions for
you if you usually do not mind. Is it only me or does it look as if like some of the comments
look like they are coming from brain dead folks? :-P
And, if you are writing on additional places, I'd like to keep up with anything
fresh you have to post. Would you list of all of your social sites
like your linkedin profile, Facebook page or twitter feed?


Add new comment