Search: Advanced search
|
Browse by category:
|
Glossary |
Search: Advanced search
|
Browse by category:
|
Glossary |
Guide to .htaccess |
|||||
.
htaccess files are "distributed configuration files" and provide a way to make configuration changes on a per-directory basis. What you can put in .htaccess files is determined by the AllowOverride directive which is set up by the host. This directive specifies, in categories, what directives will be honored if they are found in a .htaccess file. The directives used for our SEF
URL rewriting are generally allowed, however not all hosts will permit php_flags to be set, for example, to change register_globals settings. .htaccess files cause a performance hit. When a host has AllowOverride set to allow the use of .htaccess files Apache will look in every directory for .htaccess files - it looks whether you use .htaccess files or not. The .htaccess is also loaded every single time a call is made to your site . Added to this, Apache must look at every .htaccess file that exists in directories higher than the one it is calling. The way this works is basically this, eg: So, when you see me write in posts that every directive added to a .htaccess file adds to server load, you will understand why I say this. If you have a large .htaccess file with a lot of directives and you put this in your site root, you are likely to see a large hit on performance. Not only are there increased file-system accesses, but Apache has to also process whatever the directives are telling it to do. With me so far? Let's talk about the hottest topic of the month - using .htaccess to turn off register_globals. php_flag register_globals on php_flag register_globals off If this does not work for you, you can also use : php_value register_globals 0php_value register_globals 1 (ON) or 0 (OFF) - Apache recognises it as the same as the directives I have used above. If you do this, your php.info should then show that register_globals is either on or off, depending on which option you chose. Now, here is the tricky part. PHPSuExec runs under CGI and setting the register_globals in .htaccess will not work. People running Apache 1.x can use the directives above as is, but people running under Apache 2.x may need to use the directory structure. (This depends again on how your host has set this up).By "directory structure" I mean <Directory> and </Directory>. These are used to enclose a group of directives which will apply only to the named directory and sub-directories of that directory. You must make sure that you use the correct syntax for your <Directory>. This is the syntax for Apache 1.3 (search in the manual for your version of Apache) http://httpd.apache.org/docs/1.3/mod...html#directory php_flag does not work with Apache 2. Neither does writing the words "on" or "off" — you must use 0 (off) or 1 (on). So, for Apache 2.x, you use this directive to turn register_globals OFF: php_value register_globals 0 I get a 500 server error. How do I know if it is working? .htaccess is a complex area and I have only touched on some of the issues. The Apache documentation is the best place to start if you need more information. |
|||||
Copyright © 2000 - 2008 Mambo Foundation, Inc | Reg. No. A0047564G | Terms of Use | Privacy Policy
Mambo® and the Mambo logos are trademarks of the Mambo Foundation, Inc.
Managed Servers by DedicatedNOW