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.

27 Dec 2014

Fine way of telling, and nice post to get facts regarding my presentation subject matter, which
i am going to convey in university.

28 Dec 2014

I every time spent my half an hour to read this website's articles daily along with a cup of coffee.

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 Dec 2014

My brother suggested I might like this blog. He was totally right.
This post actually made my day. You cann't imagine simply how much time I had spent for this info!
Thanks!

07 Jan 2015

Actually when someone doesn't be aware of after that its up to other users that they will assist, so here it takes place.

09 Feb 2015

Those with a PC will get superior visual quality as that version will support 4K resolution when it sees release
in early 2015. By setting your aim on an opponent, you are sure to hit right where your aim is.
Society has tried to be too deeply involved with the individual.

02 Jan 2015

Thanks , I have recently been looking for information approximately this
topic for a while and yours is the greatest I've discovered till now.
However, what in regards to the conclusion? Are you positive concerning the source?

01 Feb 2015

Gday, I'm new to running a blog and websites in general and was wondering
how you got the "www" included in your web address name?
I see your domain name, "http://jmscrk.com/comment/reply/3/6466" has the www and my web
address looks like, "http://mydomain.com". Do you know just how I can change this?
I'm using Wordpress. Warm regards

04 Feb 2015

You will also want a nursery stock producer and/or vendor license from your state
division of agriculture.

12 Feb 2015

One should also take care of diet and proper relaxation in order to get rid of acne naturally.
I've found that its best to let this sit on your back for a few minutes before rinsing off for the best results.
Bear in head that acne isn't going to only seem to
the deal with and this might be anyplace inside system.

25 Feb 2015

5 Day Weight Loss Diet Day 1 - Breakfast:
a glass of water, half a glass of water,
then you're still hungry, a glass of water after an hour or so.
This requires medical attention immediately so the doctor
can assess the degree of the damage. Biking can be carried out outdoors, in parks or along
active streets, or in a health club in an enclosed environment.

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.

06 Feb 2015

Common poetry is frequently written and then read from a
leaf of paper, while hip hop poetry in this genre is also written but performed.
Music is something which is growing and evolving day by day.
B Walkers are making such an impact that bootleggers have already emerged.

25 Dec 2014

Hey! I know this is kinda off topic however I'd figured I'd ask.
Would you be interested in trading links or maybe guest authoring a blog article or vice-versa?
My blog covers a lot of the same subjects as yours
and I think we could greatly benefit from each other. If you might be interested feel free
to send me an email. I look forward to hearing from
you! Excellent blog by the way!

12 Jan 2015

Nowadays hip hop is more than just drum beats, producers
also use baselines and melodies in order to make beats.

I have Pro Tools, Logic Studio, and Ableton Live as well within my personal studio setup, and I use them whenever I get the urge.
Pick one of the many companies and copy their web address.

11 Mar 2015

I go to see every day some web sites and blogs to read articles, except this blog
presents quality based posts.

01 Jan 2015

The online adult film industry offers quite possibly the greatest opportunity
for profit compared to the required investment of time and money of perhaps any
industry today. These websites need you to pay them some quantity prior to they actually
let view your preferred MILF Grownup Videos. Thongsang lately appeared in a TV
advertisement of Thai gel product for body-builders.

03 Jan 2015

Greetings I am so delighted I found your site, I really found
you by mistake, while I was researching on Digg for something else, Anyhow I am here now and would just
like to say cheers for a incredible post and a all round entertaining
blog (I also love the theme/design), I don't have time to browse it all at the moment but I have saved it
and also added your RSS feeds, so when I have time
I will be back to read a great deal more, Please do keep
up the great job.

09 Jan 2015

I've gone ahead and included a link back to your blog from one of
my clients requesting it. We have used your blog URL:
http://jmscrk.com/comment/reply/3/6495 and blog title: Add new comment | JmsCrk to insure you
get the proper anchor text. If you woud like to see
where your hyperlink has been placed, please e mail me
at: fernepalmore@gmx.de. Appreciate it

02 Feb 2015

In the result of which these services will assign a writer for your work by looking at the subject you want your thesis in. "Dragon Age: Inquisition" is currently available on Xbox
360, Xbox One, Play - Station 4 and PC. It's a bit like your usual action slash dungeon-crawler save for a
better and more dynamic battle system than most, and the addition of a strategy menu.

24 Jan 2015

The artist has the ability to create a life-like death animation, mimicking the actions of
a character as they pass, while still restricting the motion to the game's
physics. Depending on your interests, rest assured that
there are games for anyone to play. Counter Strike or any video
game won't be enjoyable for long periods in case you generally loose.

08 Feb 2015

Through the comic book many characters were dragged to
the television also and collected so many appreciations
from all over the world. We provide some belonging in the direction of finest inventive CG expertise from near to the world.
More key frames are specified for intricate motions than for
simple, slowly varying motions.

01 Feb 2015

Hey! This is kind of off topic but I need some advice from an established blog.

Is it very hard to set up your own blog? I'm not very techincal but I can figure things out pretty fast.
I'm thinking about creating my own but I'm not sure
where to begin. Do you have any points or suggestions?
Thank you

16 Jan 2015

It is a regular reaction for the Universe to give back to
you for becoming grateful. Also includes this famous Book of Provides, Green Report,
and many other freebies with subscription of $99
a year. However, beyond these quantifiable reasons don`t lose this important fact: being grateful and sharing your gratitude is just the right thing
to do - personally and professionally.

13 Feb 2015

Majority of webcam network providers including live
jasmine spend twice per month. The production engineer carries out
process planning for the manufacture of the objects.
Then again as time goes by I needed something more, something better.

24 Jan 2015

Interestingly, many people are exercising at different paces on different days or time frames, using all of the above paces.
"Stop the threat" refers to using a block or parry to fend
off a strike or grab. In my childhood, I lost two angelic teachers who
are now residing in Heaven & were like surrogate mothers
to me.

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.

27 Dec 2014

Currently it appears like Drupal is the best blogging platform out
there right now. (from what I've read) Is that what you're using on your
blog?

17 Jan 2015

Hi there it's me, I am also visiting this web
site daily, this site is actually good and the visitors are truly sharing fastidious
thoughts.

08 Feb 2015

You actually make it seem really easy with your presentation but I find this topic to be actually one thing that I feel I would never understand.
It sort of feels too complex and very extensive for me. I am looking forward for your subsequent post, I will attempt to get the dangle of
it!

15 Feb 2015

In addition to this many people from around the world come here and visit these mines.
Having his captaincy taken away from him by Joey
Barton, Adel's game time has reduced. These shoes were designed by Carolyn Davidson a graphic designer from the
Portland State University.

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.

26 Dec 2014

You could definitely see your expertise within the work you write.
The sector hopes for even more passionate writers such as
you who aren't afraid to say how they believe. At all times go after your heart.

04 Feb 2015

These exclusive features definitely makes this handset come to life.
While it might sound hard, it really isn't, as long as you follow the right directions.
Players who wish to get the best scores when playing shooter
games online on Xbox Live should incorporate their
knowledge of the environments on each map and also peripherals like modded xbox 360 controllers
to get the best results.

13 Feb 2015

Movile's success in growing their business in the Latin America market from its start 17 years ago has
not escaped the attention of technology heavyweights.
Article Source: should try the clash of clans game.
No matter how tempting it might be, a pilot attempting to get the
Federation to look favorably upon him should refrain from attacking Gallente ships.

18 Feb 2015

Both women dared to be themselves in the changing evolution of their lives and their causes they effected.
So if you are planning to visit Madonna Di Campiglio then you must think to hire the best Transfer Madonna Di Campiglio.
She becomes a different person behind closed doors and one of her favorite holidays is Halloween when she dresses up as someone very
sexy like she did last year when she wore her naughty nurse outfit.

10 Feb 2015

Pretty grеat post. I simply stumƅled upon yokur blog and wanted to mention that
I have reаlly enjoyed surfing around your weblog posts.

After all I'll be subscribing on your feеd and I am hoping
you write once more soon!

Pages

Add new comment