Wrox Programmer Forums
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 10th, 2004, 05:39 PM
Authorized User
Join Date: May 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to ruhin Send a message via AIM to ruhin Send a message via MSN to ruhin Send a message via Yahoo to ruhin
Default .htaccess file

What is the purpose of .htaccess file ? How to use this file
for that purpose ?
Old June 10th, 2004, 05:50 PM
Authorized User
Join Date: Sep 2003
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts

It has many purposes but its main purpose is to act as a basic password protection lock for a directory. There are many tutorials available on the net. The one I used was the one of the Apache website


David Thorne, Student
Old June 16th, 2004, 04:26 PM
richard.york's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts

The .htaccess file may also be used to specify PHP ini configuration settings.

For example:
When the following is placed in a file called ".htaccess" the PHP scripts contained in the same directory as the ".htaccess" file will execute with the configuration changes specified in the file.

AddType application/x-httpd-php .html 

php_value register_globals 0
php_value error_reporting 0
php_flag expose_php off
php_value session.gc_probability 75
php_value arg_separator.output &
php_value arg_separator.input &;
.html files will be parsed by the PHP interpreter, register_globals will be turned off, error_reporting will be turned off.. etc.


The Spicy Peanut Project
Old June 23rd, 2004, 09:31 PM
Registered User
Join Date: Jun 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

PHP & .htaccess get along very nicely with each other. You can actually check if some directives have been set by Apache with .htacess using PHP!

Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess mkgupta.mca MySQL 0 August 14th, 2006 03:03 AM
.htaccess problems vertmonkee Beginning PHP 0 March 8th, 2006 07:33 AM
.htaccess question cfemocha BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 October 5th, 2004 10:36 PM
.htaccess file in root folder hopenpray Beginning PHP 1 September 8th, 2003 02:39 PM
.htaccess percy PHP How-To 1 July 2nd, 2003 02:27 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.