Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
February 09, 2012, 03:49:10 PM

Pages: [1] 2   Go Down
  Print  
Author Topic: FrontPage and the .htaccess File  (Read 9745 times)
Rick_E
Master Jedi
*****
Offline Offline

Posts: 1127


« on: January 17, 2005, 09:46:42 AM »

FrontPage creates its own .htaccess file and does not like you to modify its lines. You can however, in many cases add additional lines at the end of the .htaccess file. If you want to experiment with your .htaccess file, here are some guidelines.

* Use FTP or the File Manager to make a backup copy of FrontPage's .htaccess file.
* Add your experimental lines at the end of the file and test them.
* If your new lines cause problems, restore the original FrontPage .htaccess file.

Other tips:

* Edit the .htaccess file using Notepad or another text editor, not a word processor.

* Avoid using the hosting control panel to apply features that rewrite the .htaccess file, such as hotlink protection. Edit the .htaccess file manually.

Here's a site that generates .htaccess codes for you.
http://www.htmlbasix.com/disablehotlinking.shtml

There's documentation for .htaccess files on the Apache web site.
http://httpd.apache.org/
Logged

All the best, Rick E

Search the Microsoft KB for error messages:
http://support.microsoft.com/search/default.aspx?catalog=LCID%3D1033&spid=919&adv=1

Microsoft groups have additional FrontPage assistance:
http://www.microsoft.com/communities
Rick_E
Master Jedi
*****
Offline Offline

Posts: 1127


« Reply #1 on: January 21, 2005, 09:37:08 AM »

Here's a FrontPage workaround that allows you to add lines to the .htaccess file that would normally make FrontPage choke. The scheme uses the knowledge that FrontPage likes it's own .htaccess file while you're editing and publishing, but it will tolerate much more in the "production" environment.

The scheme uses two .htaccess files:

Editing version of the .htaccess file When you want to edit, publish, or open your site live on the server, use FTP to copy the original plain-vanilla "editing version" of the .htaccess file to the server.

Production version of the .htaccess file When you're finished editing and publishing, use FTP to copy the "production version" of the .htaccess file back to the server.

A bit clumsy but it works in some cases. Using this method you may be able to have otherwise troublesome lines in the production version of the .htaccess file, such as RewriteEngine lines.
Logged

All the best, Rick E

Search the Microsoft KB for error messages:
http://support.microsoft.com/search/default.aspx?catalog=LCID%3D1033&spid=919&adv=1

Microsoft groups have additional FrontPage assistance:
http://www.microsoft.com/communities
leighsww
* The Tough Love Cuddly One *
Berserker Poster
*****
Offline Offline

Posts: 13870


WWW
« Reply #2 on: January 21, 2005, 12:07:59 PM »

Somebody, make this a sticky  Thumbs Up
Logged
skamfroj
Certified Spammer
Intergalactic Cowboy
*****
Offline Offline

Posts: 59

BEWARE!!!


WWW
« Reply #3 on: February 20, 2005, 07:44:28 AM »

can someone help with my .htaccess

i wanted it to disable hotlinking and the use of download manager without going to my site..

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://skamfroj.net/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.skamfroj.net$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|rar|exe|zip)$ http://www.skamfroj.net/nohotlink.html [R,NC]

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^.*FlashGet.*$ [OR]
RewriteCond %{HTTP_USER_AGENT} ^.*DA\ 7.0.*$
RewriteRule /* http://www.skamfroj.net/nohotlink.html [L,R]

but this will also disable ppl using download managers who have gone to my site and click the links from my site..
can i merge them telling to enable download manager if referer is my website.

thanks in advance.
Logged

morph
Newbie
*
Offline Offline

Posts: 1


« Reply #4 on: February 27, 2005, 11:31:44 AM »

Quote from: Rick_E
Here's a FrontPage workaround that allows you to add lines to the .htaccess file that would normally make FrontPage choke.


Here is an alternative workaround that allows hotlink prevention and FrontPage to co-exist. No need to swap out htaccess files.

Instead of using the ReWrite module, use SetEnvIf instead. The ErrorDocument statement is optional - it's how you can display your "bandwidth thief" graphic with this method if you choose to.


ErrorDocument 403 YourThiefGraphic.jpeg

SetEnvIfNoCase Referer "^$" ALLOWED
SetEnvIfNoCase Referer "yourdomain.com" ALLOWED

<FilesMatch "\.(gif|jpg)$">
Order Allow,Deny
Allow from env=ALLOWED
</FilesMatch>
Logged
Rick_E
Master Jedi
*****
Offline Offline

Posts: 1127


« Reply #5 on: March 01, 2005, 09:16:43 AM »

Here is the htaccess file that FrontPage creates. If you're having trouble publishing, compare your htaccess file with this one. In particular, make sure there are no lines on top of the -FrontPage line and any lines you add are at the bottom.

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>

<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

AuthName www.domain.com
AuthUserFile /home/username/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/username/public_html/_vti_pvt/service.grp
Logged

All the best, Rick E

Search the Microsoft KB for error messages:
http://support.microsoft.com/search/default.aspx?catalog=LCID%3D1033&spid=919&adv=1

Microsoft groups have additional FrontPage assistance:
http://www.microsoft.com/communities
Tink *~*~*
Trekkie
**
Offline Offline

Posts: 11


« Reply #6 on: July 24, 2006, 03:59:44 PM »

This is a very valuable thread - thank you!

Question:  if a person, previous to becoming enlightened by this thread  Not Me had messed with their .htaccess file and didn't have a backup copy and didn't see the part about adding things to the END of the file, and used the CP button for "Hotlink Protection" and generally messed things up to the point where FrontPage keeps giving that stupid "FP extension are not installed" message, even though they ARE installed.... I mean, short of wiping out the entire contents of the public_html folder and republishing (been there, done that, it takes forever but it works)....  what is the proper sequence of actions one should take to correct it all before resorting to the wipe-out-republish method?  It seems like I've done everything to restore things to their original state.  I've uninstalled the extensions, used the cleanup old extensions button, reinstalled the extensions, blah blah blah.  I still get the stupid "FP extensions not installed" error.  And this is before I even try to manually add hotlinking protection.  I'm not a html rocket scientist, just a person with a web page trying to do this with next to no knowledge.  But it occurs to me that I'm doing things in the wrong order, so I'd be interested in the collective wisdom around here on a step-by-step sequence method for doing everything you can before resorting to wipe-out-republish.  Any input gratefully received!
Logged
fretnmore
Grandma Looney
Über Jedi
*****
Offline Offline

Posts: 2863



WWW
« Reply #7 on: July 24, 2006, 06:29:05 PM »

send a note to support@lunarpages.com and ask them to reinstall extensions on your site. Sometimes their reinstall works better than the CPanel one.  You may still have to republish your entire site and then modify your htaccess file - carefully.
Logged

Life is not measured by the number of breaths we take, but by the moments that take our breath away.
----------------------------------------------------------
Tri-Wolf Studios
Lunarpages Web Hosting
Lunarpages Forums
Lunarpages Affiliate Program
Tink *~*~*
Trekkie
**
Offline Offline

Posts: 11


« Reply #8 on: July 24, 2006, 07:28:24 PM »

Thanks for your reply.  The "help desk" (when you Ask A Question on lunarpages.com) actually directed me here, to this thread.  Is help desk different from support@lunarpages.com?
Logged
fretnmore
Grandma Looney
Über Jedi
*****
Offline Offline

Posts: 2863



WWW
« Reply #9 on: July 24, 2006, 07:34:59 PM »

The usual thing to do is to reinstall extensions. Most of the time when you do that in CPanel, it fixes things. When it doesn't, then you need to write to support and open a ticket. Ask them to reinstall the Front Page extensions on your domain. You should include your account name, domain name, and last four digits of the credit card they have on file for you.

It sounded like you had allready tried re-installing extension from CPanel, which is why I suggested you write to support.  The Help Desk would probably want you to try doing it yourself first. Most of the time, re-installing them yourself will fix it, occasionaly....it doesn't.
Logged

Life is not measured by the number of breaths we take, but by the moments that take our breath away.
----------------------------------------------------------
Tri-Wolf Studios
Lunarpages Web Hosting
Lunarpages Forums
Lunarpages Affiliate Program
Rowan
hamburglar
Über Jedi
*****
Offline Offline

Posts: 1919


I used to be Human....2.0b


WWW
« Reply #10 on: July 24, 2006, 07:37:47 PM »

I recommend using this link to contact support
http://desk.lunarpages.com/newticket.php
Logged

SteveW
Master Jedi
*****
Offline Offline

Posts: 1394


WWW
« Reply #11 on: July 25, 2006, 01:54:30 AM »

I did some experiments last week that might shed some additional light on the FrontPage Extensions (FPE) .htaccess issue.

(1)

The first question was, "Is there a security feature of FPE that checks whether .htaccess has been edited and then freezes the site if it has?" That is, does FPE use any tampering detection methods on .htaccess such as checksum verification, timestamp checking, or a hidden or encrypted shadow file that must always match? The answer to all is no, apparently not.

I was able to:

a) Edit my htaccess file from cpanel File Manager, inserting carriage returns or whitespace,

b) Copy the text from htaccess, paste it into Notepad, change LF line ends to CRLF, insert blank lines, paste it back into the server copy, and save it.

c) Add code (the security setting code for suPHP_ConfigPath) at the end of .htaccess

d) After intentionally corrupting my FPEs (by inserting mod_rewrite code), I was able to take the text from my previously known good .htaccess file, paste it back into .htaccess, and restore full FrontPage access to my site, i.e. uncorrupt the FPEs. 

None of these actions corrupted the FPEs, so my conclusion is that it is only the actions and settings specified in the .htaccess file's content that corrupts the FPE. It is not the act of tampering with the file itself.

One nice benefit of this is that if you use Rick_E's file-swapping method described above, you don't have to physically copy files in cpanel File Manager or FTP. You can simply keep multiple htaccess files on your own computer, and copy and paste the text from the one you want to use directly into htaccess on your server, and save it.

(2)

The second question was, is there any way to modify your server's configuration such that you can publish with FrontPage, use the FrontPage Extensions, and still have full use of your server's htaccess file, including such features as mod_rewrite? The answer appears to be yes.

Using cpanel > File Manager, navigate to each of the following three files and edit each using the Edit File link in the upper right corner of the screen. If you decide not to save the file, just close the browser window; the file is not saved unless you click the Save button.

/public_html/_vti_bin/.htaccess
/public_html/_vti_bin/_vti_adm/.htaccess
/public_html/_vti_bin/_vti_aut/.htaccess

At the TOP of each file there is an Options None line. Don't delete or modify it. It gives this folder a secure starting point by turning OFF any less-secure options that are enabled in folders above it.

The only edit you make is: at the very BOTTOM of each file add the following line:

Code:
Options +SymLinksIfOwnerMatch
Then Save the file.

You do not have to make any modifications to the top-level .htaccess file in your public_html folder.

If for some reason you must ever reinstall your FPE, then you must reapply these mods afterwards.



If you want to research this further, this MSN search found relevant articles: http://search.msn.com/results.aspx?q=frontpage+htaccess+vti_bin+vti_aut+vti_adm+%28FollowSymlinks+OR+SymLinksIfOwnerMatch%29&FORM=QBHP. Google and Yahoo searches for this turn up nothing.

Most (or all?) of those articles recommend using the following line instead of the one I gave:

Code:
Options +FollowSymLinks

I chose not to use that because from browsing through the Apache documentation, it appears to be less secure. SymLinksIfOwnerMatch seems to do the same thing, but applies some additional tests. It may create some additional server overhead, but only when this folder is being accessed, which is when you are publishing, which is not that often.

I can't say I understood well the differences between FollowSymLinks and SymLinksIfOwnerMatch. If you are the only person who publishes to your site, then I suspect SymLinksIfOwnerMatch will work for you, as it does for me. But if there are multiple people who publish to your site, using different user names, and if the use of SymLinksIfOwnerMatch appears to freeze them out, then FollowSymLinks is probably the next thing to try.

Some other points:

The above modifications have allowed me to use mod_rewrite (RewriteEngine, RewriteCond, RewriteRule) in my htaccess file without corrupting the FPEs. I'm hopeful that it might also allow using other cpanel features such as Hotlink Protection, IP Deny, etc., but I haven't tested any of those. If you want to experiment with those, I would suggest saving the text from your known-good htaccess file before you start (so you can paste it back in if the experiment fails), use cpanel to apply Hotlink Protection (or whichever cpanel feature you are testing), and then open public_html/.htaccess manually, locate the code that cpanel inserted into it, and move it down to the end of the file so it is out of the way of FrontPage's code, just as a precaution.

If you test this mod with other cpanel features, please post the results here, whether positive or negative.

When you copy your server's .htaccess file lines for external use, you must do it using cpanel File Manager's Edit File mode. When you use its Show File mode, critical tags that are in the file don't show, and the lines you copy, missing those tags, will be useless.
« Last Edit: July 26, 2006, 02:17:59 AM by SteveW » Logged





Mt. Shasta
photo gallery.


Don't forget Lunarpages 24/7/365 support documentation:
Flash Tutorials, Knowledge Base FAQ Articles, cPanel Manual, Glossary/Dictionary, Support Tickets,
and
Forum Search.

Tink *~*~*
Trekkie
**
Offline Offline

Posts: 11


« Reply #12 on: July 25, 2006, 01:41:16 PM »

Thanks to everyone for the replies, links, and advice.  I tried one more time to uninstall/reinstall the extensions, and thsi time it worked.  I was able to publish the changes I'd made locally.  And then I went back to the CPanel and put back the lines that I wanted in there, which of course breaks the ability to publish again.  But whatever.  I guess next time I have changes, I will "rinse and repeat"

It just seems silly that all these work-arounds are necessary.  If I had a little more time to devote to this, I would learn to use something that's maybe more complicated, but doesn't need the work-arounds.  Maybe someday I'll put a toe in the water with Dreamweaver...

Thanks again!

PS - If anyone is interested in reading about adventures at Disney, on Sanibel Island, house hunting, house building, house decorating, and moving to a different planet, here's where my page is at -

http://www.TinkRBell.com
Logged
SteveW
Master Jedi
*****
Offline Offline

Posts: 1394


WWW
« Reply #13 on: July 26, 2006, 02:16:56 AM »

Tink *~*~*, it looks like your best solution for the time being would be Rick_E's file swapping method.

Immediately after you have reinstalled your FPE's from scratch (but before you apply any cpanel options like Hotlink Protection), use cpanel > File Manager to go to your public_html/.htaccess file, go into Edit mode, copy all of its lines, (then close the browser window; the file won't be saved) and save the copied lines into a Notepad file on your local computer. This is your basic htaccess file. It is known-good, and if you subsequently corrupt your FPE's again, you should be able to place this text into htaccess on your server, and restore your FrontPage access.

After you have installed Hotlink Protection from cpanel, follow the same procedure as above, but save these text lines to a different file. This is your "but I can't publish from FrontPage!" htaccess file. It has Hotlink Protection lines in it that corrupt your FPE's.

Use this second file when your site is in normal operation.

When you want to publish with FrontPage, paste the text from your known-good htaccess file into htaccess on your server first. Then publish.  Then put your second file back in place.

I guess it sounds complicated until you've done it a couple of times, but it's a lot easier than reinstalling the FPE's all the time.
Logged





Mt. Shasta
photo gallery.


Don't forget Lunarpages 24/7/365 support documentation:
Flash Tutorials, Knowledge Base FAQ Articles, cPanel Manual, Glossary/Dictionary, Support Tickets,
and
Forum Search.

SteveW
Master Jedi
*****
Offline Offline

Posts: 1394


WWW
« Reply #14 on: July 26, 2006, 08:32:58 AM »

As described above, certain .htaccess files can be modified to allow the insertion of RewriteEngine code for www to non-www redirection. I've now tested the configuration with the following cpanel features, and they all work without corrupting the FPE's. By the end of testing, they were all enabled simultaneously:

Index Manager
Redirects
MIME Types
Hotlink Protection
IP Deny

However, in the course of testing, it became evident that there are flaws in how cpanel manages the .htaccess file. These are not FrontPage's fault.

Cpanel is apparently not a component of Linux or Apache. It is an independent module that attempts to provide a user friendly interface to the features of your server. It tries to take options you select and translate them to the corresponding code of the underlying system. But like almost any user friendly automated code generator, its features are crude and error-prone compared to what you can accomplish if you work with the underlying system directly.

In order to work properly, cpanel has to correctly parse (interpret) the existing contents of htaccess, which it seems unable to do in certain circumstances. Then, if its method of modifying htaccess consists of inserting at a random location a block of cookie-cutter code, without regard for other code in htaccess that might modify or conflict with the block being inserted, which also appears to occur, then it's no wonder that htaccess can end up in disarray.

Therefore, cpanel should not be completely trusted with management of your htaccess files, whether you use FrontPage or not. It is much more advisable, in all cases, to determine the correct code to achieve a desired objective, and insert it into your htaccess manually. You can still use cpanel to generate the code, but you should look at what it did and decide whether it's correct.

Experiments done and the results:

Index Manager
Turning off indexes for the public_html folder inserted this code into htaccess

Code:
Options All -Indexes

This is more meddlesome than is required. The All enables FollowSymlinks and some other less secure features.

Code:
Options -Indexes
would do the job, without the side effects.

MIME Types
I set up a MIME type for Windows wma files. Cpanel inserted this code. No FPE problems:

Code:
AddType audio/x-ms-wma wma


Hotlink Protection
Enabling the default Hotlink Protection caused cpanel to insert this code. The first RewriteCond line allows direct access (such as from a browser or media player). Omit the line if you don't want to allow direct access.

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://mydomain.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ http://mydomain.com/bandwidththief.htm [R,NC]

The last line above should have an L in it [R,NC,L].  This is a cpanel error. As long as this is the only block of Rewrite code in your site (which is what cpanel expects), it won't cause problems. If you have other Rewrite blocks, it will cause problems.

If you have any preexisting Rewrite blocks in your htaccess, then when you go to cpanel Hotlink Protection, it shows Hotlink Protection as enabled, even though it's really not, and the default entries that it shows for sites from which to allow access and for allowed/disallowed file types are taken from all the Rewrite lines that it finds, whether or not they have anything to do with hotlink protection! And the values it extracts from those lines are totally wrong. They will not accomplish Hotlink Protection at all. In other words, this is not a bug of the FrontPage Extensions, but of cpanel.  It is unable to distinguish between RewriteEngine lines that relate to hotlink protection and ones that are there for other purposes. This can make a mess of your htaccess file.

Redirects
This code was inserted:

Code:
RedirectMatch temp ^/dummy2.htm$ http://mydomain.com/dummy1.htm

Note how the redirect avoids using the RewriteEngine. This may be evidence that RewriteEngine is reserved for the use of Hotlink Protection, and no other cpanel feature is allowed to use it. But the redirect works and is correctly only applied when people access your site from the web. That is, if you request the redirected page from within FrontPage, you get the file you asked for, not the other one!

IP Deny
I set it up to deny my own IP address. (It blocked browser access, but cpanel access was still allowed.) IPDeny made more changes to htaccess than any other feature, including ones to the default FrontPage deny,allow sections. It changed this (default FrontPage):

Code:
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
To this:
Code:
<Limit GET POST>
#The next line modified by DenyIP
order allow,deny
#The next line modified by DenyIP
#deny from all
allow from all
</Limit>

Presumably this part allows showing the Forbidden page, even to the denied party:
Code:
<Files 403.shtml>
order allow,deny
allow from all
</Files>

This does the denial.
Code:
deny from xxx.255.193.45

Unsure how significant the changes are. It might be that the default settings do basically nothing, allowing access to everyone. But before using this, I'd study it more carefully to make sure site security isn't compromised. Removing the IP Deny did not restore the modified htaccess sections to their previous default state.

----------------

As an example of something you can do manually that cpanel cannot do, these two sections happily co-exist. The first block correctly redirects www to non-www, then the second prohibits the hotlink:

Code:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L]

RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://mydomain.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ http://mydomain.com/bandwidththief.htm [R,NC,L]

--------------------

To all, please point out any errors in the above so they can be corrected.
« Last Edit: July 26, 2006, 08:36:36 AM by SteveW » Logged





Mt. Shasta
photo gallery.


Don't forget Lunarpages 24/7/365 support documentation:
Flash Tutorials, Knowledge Base FAQ Articles, cPanel Manual, Glossary/Dictionary, Support Tickets,
and
Forum Search.

Pages: [1] 2   Go Up
  Print  
 
Jump to: