Microsoft "FrontPage" and Your .htaccess File

The Problem

(You should already have read most of the file YourFile, about .htaccess files and their value and uses; if you haven't, please do so before reading this document.)

The .htaccess file is a configuration file found on Apache-powered servers. Servers running, for example, Microsoft server software do not have an .htaccess file, nor any close equivalent. You will by now have read some of the amazing things your .htaccess file allows you to do on an Apache server.

Microsoft, in designing FrontPage, opted to call certain of FrontPage's many private configuration files ".htaccess"; FrontPage typically strews several files of that name across the directories of a web site on which it is being used. Moreover, FrontPage frequently rewrites those files, and--the crux--will cease to function, claiming it cannot access the site, if any real Apache .htaccess configuration lines are put in a FrontPage-generated .htaccess file.

Two points. First, while there is some disagreement among the sources on the web as to whether any normal .htaccess instruction breaks FrontPage or only certain ones (and I am not in a position to experiment, as I do not use FrontPage, or any file-creation tool beyond a text editor), it is universally agreed that redirection absolutely, positively cannot be made to work from a FrontPage htaccess file. So are you dead in the water for this package? By no means: stay tuned.

Second, though what matters is the effect not the cause, reasonable minds can have little doubt that this was a coldly calculated and deliberate move on Microsoft's part to use a popular piece of their software as a tool to seriously cripple the usefulness of a highly popular non-Microsoft server type. There was no need in the world for them to give their private config files the highly unusual and particular name ".htaccess" save to make real .htaccess files--with all the power they give Apache users--unusable.


One way in which you can regain your .htaccess file is to not use FrontPage's "publish to server" method. (One sees everywhere on the web experts who remark that few people use that mode anyway.) Instead, use the "publish to file" option and then ftp-upload the resultant files.

There are several ancillary advantages to be gained from that approach, and you can and should Google the topic if you are presently using "publish to server". (That's just a personal recommendation, as is the larger one that you seriously consider switching to Dreamweaver, for reasons which, again, you can Google up.)


But this package does not require you to change your software or your work habits.


The Solution

First of all, if you do not use FrontPage's "publish to server" option--that is, if you use "publish to file" to do all your work locally (on your computer) and then just ftp-upload the results, you have no problem--you can just go ahead and follow the regular install instructions for this package, so let's just return to the YourFile document.

If you do use "publish to server" (and thus the so-called "FrontPage Extensions" as supplied by your ISP), then what you need to do is keep two distinct root-directory .htaccess files and swap them out before and after a FrontPage editing session. More exactly: as a one-time effort--

a. Create an Apache-suitable .htaccess file and name it something distinctive, such as APACHE.htaccess; you can use the sample from this package as your basis and add in anything else you want in such a file (and anything that you might have now, if there are any non-FrontPage lines in your current root-directory .htaccess file). Put this file somewhere safe, preferably in the root directory of your local copy of your site.

b. Download a copy of your current root-directory .htaccess file. Rename it to something also distinctive, such as MSFP.htaccess. Keep it where you are keeping your APACHE.htaccess (or however named) file.

c. Copy (do not rename) your APACHE.htaccess (or however named) file to just .htaccess and ftp-upload it--in ASCII transfer mode--to your site's root directory, overwriting the like-named file now there (of which you just saved a copy).

You can now use your web site as a normal Apache-hosted site, using the full power of your .htaccess file. But . . . when it is time to do a FrontPage edit of your site, you need to do these things:

1. Copy (do not rename) your MSFP.htaccess (or however named) file to just .htaccess and ftp-upload it--in ASCII transfer mode--to your site's root directory, overwriting the like-named file now there.

2. Do your FrontPage session work as usual.

3. When finished with FrontPage, download a copy of your newly current root-directory .htaccess file and rename it to MSFP.htaccess (or whatever name you are using), overwriting the older like-named local file.

4. Copy (do not rename) your APACHE.htaccess (or however named) file to just .htaccess and ftp-upload it--in ASCII transfer mode--to your site's root directory, overwriting the like-named file now there.

You can resume normal operation. Do be aware that for the period you are using FrontPage (that is, while the FrontPage .htaccess file is in place) your users will be unable to use your fine new bookshop: if they click on a title, they will get a 500 Error report because your FrontPage .htaccess file cannot redirect their URL calls to the php script.

I say again that if this is you, you should give very, very serious consideration to using FrontPage in the way most experts seem to: do your editing locally, then ftp-upload the resulting page files. I'm not asking you to take my word for it: Google around on the topic.

Anyway, all that will be found to be faster and easier to do than to describe (you could probably write a simple script to automate the swapping in and out). Now let's return to the YourFile document.