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.

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?

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.

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.

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

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.

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.

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.

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.

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.

05 Jan 2015

I feel this is among the most significsnt info for me.

And i'm happy reading your article. However want to remark onn some basic issues, The web site taste
is great, the articles is in point of fact great : D. Good task,
cheers

24 Jan 2015

The most obvious change will be the all-important buy for its graphics using an advanced version in the
Source Engine. Some of the people today who have in no way dealt with a gaming mouse see the added value which is often attached to be
able to these mouses in addition to believe, "can it greater my report. Be sure to disable or turn off any non-Windows based firewalls.

27 Dec 2014

I believe this is one of the such a lot significant info for me.
And i'm happy studying your article. However want to statement on few common things, The site style is great, the articles is in reality great :
D. Good process, cheers

27 Dec 2014

Your style is unique in comparison to other people I have read stuff from.
Thanks for posting when you have the opportunity, Guess I'll just bookmark this blog.

30 Dec 2014

Download or purchase this farm themed game over the Big Fish
Games. The Dreamcast was the initial console to help you to play online with other gamers.
The tactic that may be finding utilized is various from standard
discovering process. When you see the enemy in their own uniforms, it'll pump you approximately
cope with them. For starters, we'd like to pick an area where our currency, something (US dollar, NZ dollar, etc.

Nothing will beat that with regards to simplicity. There are numerous plain car games, some asking you to race other
cars plus some asking you to shoot down your enemies that are coming
towards you. Teensy Studios has challenged your reflexes again by offering another Android Smartwatch game using a simple
but different idea. We live without any doubt
in the era of technology. It then says drench and squeezes
water on top of the person. 99 only and may be played simultaneously by one
or two players. It is basically a crucial area of review that a lot of of the
concept is generally integrated on lifestyle model. If anybody is in to a babysitting job, playing the child video gaming
would enrich the babysitter with essential insights on as being
a dependable babysitter. The interest in flash games
can be attributed towards the fact that they are
available inside a wide range of categories like adventure, action, role doing
offers, simulations, educational, puzzle games, 2D and 3D
games, single and multiple player games. Users are now able to
also create and play their particular flash games on certain web sites.

Some of the very popular include Math Millionaire, Bee Smart Math Addition Spider Attack, and Fraction Monkey.
Yes you certainly can All that's left is usually to play your brand-new backup, or perhaps bask
within the security of experiencing 1. A Halo-inspired skin rearranges Windows Media Player's buttons in to a military-green disc similar to
Master Chief's armor, and many versions of World of Warcraft-themed skins exists for players
which drape their music inside colors in the Horde or Alliance.
Snow White Cafe is a magical destination to eat for princes
and princesses from all of over fairyland. They can be intimidating and authoritative which is
the exact message that you need to portray to your customers.
Traditional network games require players to use whenever you want, within the process players have devoted myself on the game which, together with not do anything besides the overall game, an incredibly affecting
their work and rest, this is the most traditional online flash games social criticism reasons:
inside the end is people play games, or game
playing people. Soccer shows you team leadership and management so as to take your
team forward for the path of victory. The collection of real cars that you just could select
was astounding. You can silicon lube in spray format or it is possible
to buy complete gun cleaning kits with everything
you need to manage your firearm. Inside every
little teenager boy or ex boy, now a grown-up man, there's a severe speed-addict.

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.

29 Dec 2014

Pretty great post. I just stumbled upon your weblog and wanted to mention that I have truly
loved browsing your weblog posts. In any case I will be subscribing for your rss feed and I hope you write
once more very soon!

04 Jan 2015

As the admin of this web page is working, no hesitation very rapidly it will be renowned, due to its
quality contents.

08 Jan 2015

Hello! I'm at work surfing around your blog from my new iphone
4! Just wanted to say I love reading through your blog and look
forward to all your posts! Carry on the great work!

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?

06 Jan 2015

Thank you a lot for sharing this with all peopl you actually recognise whaqt you are talking about!
Bookmarked. Please also talk over with mmy web sute =). We can have a hyperlink exchange contract among us

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.

Pages

Add new comment