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?

21 Dec 2014

Nelson Bay is only three hours from Sydney and
so makes the ideal spot for a school excursion. High and mid ranges sound decent
and the bass is adequate for typical gaming applications.
Because terrapins are susceptible to diseases from algae,
fungi, bacteria you have to ensure your pet does not become infected.

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.

21 Dec 2014

Be aware of monitoring your child's gaming practices. You might not be able to
afford this, especially if you are not sure if you will like the game.
Many websites and game promoters provide free tools and software for regular players regarding clash of clans.

20 Aug 2014

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

21 Dec 2014

Incredible points. Outstanding arguments. Keep up the good work.

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.

21 Dec 2014

He mentioned the happened at that time: "the break I a dressing room, feel wrong into sit stand up, the eye also suddenly see not pure, I on the surrounding space lost consciousness after impact. - You believe that the outcome over a series of trades is relatively certain and predictable. Be worth what carry is, last week and fulham's carling cup, petr cech's head and a knock.

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

19 Dec 2014

If you give your friends $50 gift cards that you only paid $35 for, that saves you a lot of money.
A popular gift card is one for Border's Book Store in a typical amount of $25
which gives the person with the gift card a chance to buy magazines, dvds, childrens toys, books, cds and coffee where offered.

This feature comes handy when the required product is not listed in the
apps price comparison engine.

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

20 Dec 2014

Hey! Someone in my Facebook group shared this site with us so I came to take a look.
I'm definitely enjoying the information. I'm book-marking and will
be tweeting this to my followers! Wonderful blog and terrific design and style.

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 =)

21 Dec 2014

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

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!

21 Dec 2014

Select View or change existing e-mail accounts, and then click Next.
When you call these people up, theyll do all your work for you.

It responds quickly to antacids, relieving that bitter taste that is sometimes left in the mouth.

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.

21 Dec 2014

Any school children who have never been on a boat or seen dolphins playing in the
ocean would be absolutely thrilled to go on a school excursion that included such a delightful activity.
Having construction home improvement done is always exciting but be sure you know
what you are getting into and make sure you get contractors that are
reputable and trustworthy before you sign on that bottom line.

Though a sweet victory, Marion Barber left the game with a foot injury.

20 Dec 2014

I always spent my half an hour to read this website's content all the time along with a mug of coffee.

Pages

Add new comment