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?

11 Sep 2014

I do believe all the ideas you've presented in your post.
They are very convincing and will certainly work.
Still, the posts are too brief for starters.
Could you please lengthen them a bit from next time? Thanks for
the post.

18 Dec 2014

Most Internet marketers are looking for a "get rich quick" solution for their problems,
and they come into this industry without learning the basics.
Again, the best way to increase page rank is to stay consistant.
To learn more about meta keywords and search engine optimization, read up here: Optimizing Search Engine Results with Meta Keywords.

20 Aug 2014

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

17 Dec 2014

You made some decent points there. I checked on the net to find out more about the
issue and found most individuals will go along with
your views on this site.

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.

05 Sep 2014

I likе the valuable info you provide in yoir articles.
I will bookmark үouг blo аnd check agаin heree frequently.
І'm quite certɑin ӏ'll learn a loot of neա stuff rіght heгe!
Gоod luck fօr the next!

26 Oct 2014

The following couple of years will likely be as to what many of us do together to generate people better.
Google is obviously focusing on releasing an API, however it
is not there yet. You can test your backgrounds in what is termed
Sprite - Method - Test by checking the fundamental vert quads are in-line with your orthographic projections.

13 Nov 2014

I just could not leave your web site prior to suggesting that I really
loved the standard info an individual supply in your visitors?
Is going to be back incessantly to inspect new posts

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.

03 Dec 2014

Аs the admin of thіs web site is working, no hesitation vеry shortly іt ԝill be
famous, ԁue tߋ its feature contents.

15 Dec 2014

Find out what else the developers have planned for Postal 3.
Cost is one of the major problems with the series of shots which is said to run between $350 and
$360 per patient. There are two kinds of design specs for well-being - the first are
those that apply to every human being as a
universal truth of human health, and then those that are unique to our uniqueness.

17 Dec 2014

I savor, lead to I discovered exactly what I was looking for.

You've ended my four day lengthy hunt! God Bless you man. Have a great day.
Bye

07 Dec 2014

Hey there! Quick question that's completely off topic.
Do you know how to make your site mobile friendly?
My weblog looks weird when viewing from my iphone4.
I'm trying to find a theme or plugin that might
be able to correct this problem. If you have any suggestions, please share.
Appreciate it!

16 Dec 2014

Make sure that the photos you post are unique and eye-catching.

No business is perfect, so try to find out as much as you
can regarding the good and bad experiences other customers have had with them.
One of the characters chooses to look common by adding fake fans How difficult was it.

17 Dec 2014

I am extremely inspired along with your writing skills as smartly as
with the layout to your weblog. Is that this a paid subject matter or
did you customize it yourself? Either way stay up the excellent high quality writing,
it's rare to peer a nice blog like this one today..

17 Dec 2014

Terrific article! That is the type of info that should be shared across the web.

Disgrace on Google for not positioning this post higher!
Come on over and seek advice from my web site . Thank you =)

19 Nov 2014

The great toughness that Anavar presents is believed that would come from its investment to promote
the skin to bring about far more phosphocreatine, and is progressively utilized in the production of ATP in other words.
the male body's main brief chemical. Anavar could one of the few usefulness of anabolic steroids
that females realize accustomed to create. But you can find some unwanted of Anavar and, nonetheless a
lot less accompanying opposite steroids. become older, One side-effect a variety of are referring to considering Winstrol
involves the injectable Depot appearance as shots are normally extremely begin hurting which is normal with water-based steroid
drugs. It ought to be kept in mind although Winstrol will likely not quash healthy the
male growth hormone creation with the sum other sorts of steroids
something like Deca-Durabolin which will undoubtedly suppress all performance after one measure, Winstrol brings approximately some crushing.
Against training coming across winstrol relation cardiac seek
apart anyway. of dental Winstrol, whereas individuals holding
shots kind Winstrol must work under 25-50mg of Winstrol
Anavar: Anavar is a very minimal anabolic steroid recommended many times for opposing fat reduction from HIV and alky
hepatitis and individuals with Turner's problem.
Testosterone: These steroid capsules hasten the formation of muscle foods
high in protein, with an increase of height and width of
muscle mass and a quicker handling solution. Winstrol: This medication contains delicate anabolic premises
vis-à-vis many other usefulness of anabolic steroids. company electrical power
expenses perfect time during left to Republicans for chastened which explains
emerge rehab and relieved so of source depot gleefully
sexual intercourse actually purchase winstrol depot have to have the eleven all
this will you be preceding recruiter that those contrite Winstrol
often makes birds look more stressed than others who don't acknowledge any steroid drugs.

10 Dec 2014

You ought to be a part of a contest for one of the greatest sites on the web.
I most certainly will recommend this web site!

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.

Pages

Add new comment