# Web Site Help:  How do I make the computer run the site locally?

**URL:** <https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660>\
**Category:** Factual Questions\
**Created:** [October 13, 2009, 3:34pm UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660 "2009-10-13T15:34:53Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Whack-a-Mole](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/whack-a-mole/32/141_2.png) [@Whack-a-Mole](https://boards.straightdope.com/u/Whack-a-Mole)\
**Post date:** [October 13, 2009, 3:34pm UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660/1 "2009-10-13T15:34:53Z")

</div>

I am trying to move a Wiki website (backup of one anyway) to a laptop so we can show people the site without it being connected to the internet.

Essentially I want to run the site entirely locally and not have the computer think it needs to go to the web. So, internal links in the Wiki need to pull up pages from the internal website.

Is there a way to tell my PC to do that?

---

<div class="post-metadata">

**Author:** ![pan1](https://avatars.discourse-cdn.com/v4/letter/p/e495f1/32.png) [@pan1](https://boards.straightdope.com/u/pan1)\
**Post date:** [October 13, 2009, 3:37pm UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660/2 "2009-10-13T15:37:25Z")

</div>

file --\> save as --\> webarchive.

it should then load up as normal on your PC.

---

<div class="post-metadata">

**Author:** ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)\
**Post date:** [October 13, 2009, 3:44pm UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660/3 "2009-10-13T15:44:44Z")

</div>

Someone else will come along with a more detailed answer, but basically you need…

All your links to be document or site-root relative…

_\<a href=“/pages/page-about-bunnies.htm”\> A Page about bunnies\</a\>_ - Good.

_\<a href=“…/page-about-bunnies.htm”\> A Page about bunnies\</a\>_ - Good.

_\<a href=“page-about-bunnies.htm”\> A Page about bunnies\</a\>_ - Good.

_\<a href=“[http://yourwebsiteurl.com/pages/page-about-bunnies.htm](http://yourwebsiteurl.com/pages/page-about-bunnies.htm)”\> A Page about bunnies\</a\>_ - Bad.  
And if your page uses ASP - your computer needs to be running as an ASP enabled web server (Install Microsofts Internet Information Services) and you access your site via [http://localhost](http://localhost).

Same for if your site uses PHP - you need your computer to be running a PHP server (Apache) and you access the site from [http://localhost](http://localhost).  
But mainly, if you’re testing a basic html page with links on it, and you want your links to work - they all have to be document or site root relative. once you move your site to a web server all the links should still work - as long as the directory structure remains the same.

---

<div class="post-metadata">

**Author:** ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)\
**Post date:** [October 13, 2009, 3:46pm UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660/4 "2009-10-13T15:46:39Z")

</div>

> [@pan1](#):
>
> file –\> save as –\> webarchive.
> 
> it should then load up as normal on your PC.

That sounds very specific to a particular website authoring application. My answer refers to websites in general…

Ideally all links should be document or site-root relative. Unless the link is to an external website (different server with a different url) in which case they have to be ‘absolute’ (not relative to the current file, but a complete address, such as the last ‘bad’ example in my previous post)

---

<div class="post-metadata">

**Author:** ![Larry\_Mudd](https://avatars.discourse-cdn.com/v4/letter/l/f14d63/32.png) [@Larry\_Mudd](https://boards.straightdope.com/u/Larry_Mudd)\
**Post date:** [October 13, 2009, 3:53pm UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660/5 "2009-10-13T15:53:05Z")

</div>

> [@Lobsang](#):
>
> Someone else will come along with a more detailed answer, but basically you need…
> 
> All your links to be document or site-root relative…

While this is good practice, if you are unfortunate enough to have a bunch of hard-coded URL’s in there which reference the domain, it may be easier to add an entry to the [HOSTS file](http://en.wikipedia.org/wiki/Hosts_file) on the machine you want to use, to define [yoururl.com](http://yoururl.com) as 127.0.0.1. This way, links to the domain will be served up from the local machine.

---

<div class="post-metadata">

**Author:** ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)\
**Post date:** [October 13, 2009, 4:06pm UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660/6 "2009-10-13T16:06:54Z")

</div>

A bunch of HTML pages could just be dumped on a PC and accessed without further ado, but a Wiki is not just a collection of static web pages, it’s an editable content database. “Wiki” is kind of a generic term and there is more than one way to implement one. The one that Wikipedia uses (we use the same one at my office) uses PHP. Therefore

> [@Lobsang](#):
>
> …you need your computer to be running a PHP server (Apache) and you access the site from [http://localhost](http://localhost).

I am not sure what database it uses.

I also do web site development on my home PC using PHP and MySQL. I use a free package called EasyPHPwhich bundles PHP, MySQL, and Apache. It’s not very difficult to get it going but you do have to get it configured properly.

If the Wiki has links outside the Wiki, then you have a whole nother issue to deal with based on how you’re connected to the network (but not connected to the Internet?).

---

<div class="post-metadata">

**Author:** ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)\
**Post date:** [October 13, 2009, 4:21pm UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660/7 "2009-10-13T16:21:12Z")

</div>

I use WAMP (Well I don’t because I now have a hosted website. But I have used wamp)

---

<div class="post-metadata">

**Author:** ![Really\_Not\_All\_That\_Bright](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@Really\_Not\_All\_That\_Bright](https://boards.straightdope.com/u/Really_Not_All_That_Bright)\
**Post date:** [October 13, 2009, 4:52pm UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660/8 "2009-10-13T16:52:03Z")

</div>

> [@Lobsang](#):
>
> That sounds very specific to a particular website authoring application. My answer refers to websites in general…

Well, it works in IE. I think you have to do it for each specific page you want to view, though.

---

<div class="post-metadata">

**Author:** ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)\
**Post date:** [October 13, 2009, 4:57pm UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660/9 "2009-10-13T16:57:52Z")

</div>

> [@Really\_Not\_All\_That\_Bright](#):
>
> Well, it works in IE. I think you have to do it for each specific page you want to view, though.

And I think it would get messy. I could be wrong but if you were to ‘redeploy’ the website back to a web server it would fail spectacularly.

No, the most ‘correct’ solution is to make sure your links work on and offline by making them all relative.

---

<div class="post-metadata">

**Author:** ![Whack-a-Mole](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/whack-a-mole/32/141_2.png) [@Whack-a-Mole](https://boards.straightdope.com/u/Whack-a-Mole)\
**Post date:** [October 13, 2009, 6:23pm UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660/10 "2009-10-13T18:23:48Z")

</div>

What about using [$wgAllDBsAreLocalhost](http://www.mediawiki.org/wiki/Manual:$wgAllDBsAreLocalhost)?

Says it makes the database go to LocalHost.

---

<div class="post-metadata">

**Author:** ![si\_blakely](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@si\_blakely](https://boards.straightdope.com/u/si_blakely)\
**Post date:** [October 14, 2009, 9:46am UTC](https://boards.straightdope.com/t/web-site-help-how-do-i-make-the-computer-run-the-site-locally/513660/11 "2009-10-14T09:46:35Z")

</div>

If (as I surmise from the previous link) you are using MediaWiki…

First, you need a WAMP (I am assuming a Windows laptop here) setup - there are several WAMP installers available, I would use a portable one, like [The Uniform Server](http://www.uniformserver.com/) or similar.

Then you need to copy the html directory for MediaWiki (including all resource files) into a directory of the WAMP http server. Then you will need to dump the MediaWiki MySQL tables from your working system and load the dump onto the MySQL on your WAMP system. Ensure you set the access accounts on the WAMP MySQL server to match the accounts on the working MySQL server. I am guessing that your MySQL server is on the same host as your apache server. If not, edit your config.php (or similar) to fix this.

Once you have done this, you should be good to go - MediaWiki uses relative html and does not (seem to) need to know the local server name to generate URLs, so [http://localhost/mediawiki](http://localhost/mediawiki) should just work. However, it may be an idea to add your final domain to the local HOSTS file (C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS) as a redirection to localhost, so you can see the urls as they should be.

Si
