Sea Crest Hosting Forum Index Sea Crest Hosting
Quality Web Hosting with a Personal Touch...
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

.htaccess Mod Rewrites in Front Page

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Sea Crest Hosting Forum Index -> Front Page
View previous topic :: View next topic  
Author Message
Piggie
Site Admin


Joined: 10 Dec 2005
Posts: 59
Location: Florida

PostPosted: Tue Aug 29, 2006 10:40 pm    Post subject: .htaccess Mod Rewrites in Front Page Reply with quote

How to use directives in .httaccess files with FP (Front Page) extensions on an Apache web server (normally a Linux server). Allowing you to use FollowSymlinks and Mod Rewrites for Redirects or Hot linking.

Note: If you are not using an Apache web server or if you don't use FP exts or use them but publish with a third party FTP program you can skip this tutorial, as it only applies to sites that use their FP exts on an Apache web server. Also note that your hosting company must have FollowSymlinks and Mod Rewrites turned on in the Apache for use in an .htaccess file.

IMPORTANT: Make backups of all your original .htaccess files. If something goes wrong, you will need then or you will have to reinstall your FP exts. If something does go wrong just put the old files back, and no harm will be done.

You also need a good Unix text file editor such as Program File Editor (PFE32).
Get the pfe101i.zip file from:
ftp://ifarchive.org/if-archive/programming/editors/pfe101i.zip
Unzip it into the windows folder of your choice and create your own shortcut to the program. It doesn't install like most programs you might be used to adding to your windows box. Those of you running Linux at home understand, and I believe the text editor built into a MAC will allow saving in Linux format natively, and if not find a MAC editor that will.

Background:

If one has FP exts active on their site, they have more than normal number of .htaccess files than on a normal web site set up. If you add anything that requires the line +FollowSymlinks, in the main .htaccess file, then unless you modify the other three .htaccess files shown here you will not be able to log into your site with FP or any of it's sub webs.

The other three .htaccess files actually control how the one we have all grown to know as the main .htaccess file in the root works. Well sort of, but a good way to understand it at this point.

Those other three are in /_vti_bin folder. One is in the root of this folder and one each in each of the subdirectories of /_vti_bin,

/_vti_bin/.htaccess

/_vti_bin/_vti_aut/.htaccess

/_vti_bin/_vti_adm/.htaccess

All three "super files" are just called the standard name of .htaccess
Again, their purpose is to control authorization to the site via FP program access.

While all three are slightly different, they all start with the same line that must be changed. So here is one to show how it looks when FP makes it (original):
NOTE: The path in the last two lines will reflect the absolute path of your server and will probably be different than those listed.

Code:
# -FrontPage-

Options None

order deny,allow
deny from all
allow from all

order deny,allow
deny from all

AuthName yourdomain.tld
AuthUserFile /var/www/vhosts/yourdomain.tld/httpdocs/_vti_pvt/service.pwd
AuthGroupFile /var/www/vhosts/yourdomain.tld/httpdocs/_vti_pvt/service.grp


All you do is modify the first line of this one and the other two super .htaccess files you find in the /_vti_bin/ directory and it's subdirectories as shown below.

Note: If there wasn't a Options None line in your original .htaccees still add the
Options +FollowSymlinks to the top of the file under any comments. (comments are lines that start with the number or pound sign # )

Code:
# -FrontPage-

Options +FollowSymlinks

order deny,allow
deny from all
allow from all

order deny,allow
deny from all

AuthName yourdomain.tld
AuthUserFile /var/www/vhosts/yourdomain.tld/httpdocs/_vti_pvt/service.pwd
AuthGroupFile /var/www/vhosts/yourdomain.tld/httpdocs/_vti_pvt/service.grp


Ok, most of the work is now done. What you have really done here is change the FP exts and tell them to allow you access with FollowSymlinks back on, whereas FP defaults to Options None. Note that this CANNOT be done from FP, and must be
done with SSH or FTP. And since _vti_bin is a server side FP extension, you can't
even see it in the folders list of FP even if you turn show hidden files on. And on most systems if you reinstall your FP exts, this work will be over written, so save these modified files also!

Very Important: If you have any subweb set up, you must copy these three modified .htaccess files into the subweb as well. For example if your subweb is called well subweb the public html path would be:

/subweb/_vti_bin/.htaccess
/subweb/_vti_bin /_vti_aut/.htaccess
/subweb/_vti_bin /_vti_adm/.htaccess

And so on if you have nested subweb structure modify those files also.
/subweb/subweb2/_vti_bin/.htaccess
And so on as above.
______________________

Last step.

Now go to the main .htaccess file in the root of your public html area

/.htaccess

Again I will show the default file then the modified file.


Default FP main /.htaccess file:

Code:
# -FrontPage-

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

order deny,allow
deny from all
allow from all

order deny,allow
deny from all

AuthName yourdomain.tld
AuthUserFile /var/www/vhosts/yourdomain.tld/httpdocs/_vti_pvt/service.pwd
AuthGroupFile /var/www/vhosts/yourdomain.tld/httpdocs/_vti_pvt/service.grp


Now one can add mod rewrites below what FP puts in here itself.
Leave a blank line between what FP puts in .htaccess and the lines you add. This creates a delimiter that is more for human readability than functional.

Lets suppose you want to turn off the TRACE requests. Here is what you normally
put in .htaccess

Code:
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]

Hence the new /.htaccess file looks like this (the one in the root of public_html):
Code:

# -FrontPage-

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

order deny,allow
deny from all
allow from all

order deny,allow
deny from all

AuthName yourdomain.tld
AuthUserFile /var/www/vhosts/yourdomain.tld/httpdocs/_vti_pvt/service.pwd
AuthGroupFile /var/www/vhosts/yourdomain.tld/httpdocs/_vti_pvt/service.grp

RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]


Note: If you read this to do a 301 Redirect, then just replace the added code above with the standard mod rewrite code.
Redirects using htaccess files

Or replace it with the no hot linking code covered in other sections.
Hot Linking - Explained

You are done. The test to see that you didn't mess up FP is to log on the website with FP. If you still can, then you did it right. If you can't log on, you probably messed up one of the 3 super .htaccess files ( /_vti_bin/ , as opposed to the one in the root being the cause.
Check those three files again, then if needed fix them and upload them again.

Remember, if you reset your FP extensions on any control panel system, this work will probably be set back to FP defaults. So its good to store a copy of these modified files some where and your original .htaccess files

The End...

Locked Topic - Please start a new topic in this section to discuss this Topic.
_________________
This forum is made entirely of post consumer data bits... Piggie Piggie!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Sea Crest Hosting Forum Index -> Front Page All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Sponsored by Sea Crest Hosting © 2005, 2007
Quality Web Hosting with a Personal Touch...

Powered by phpBB © 2001, 2007 phpBB Group