Configuring Apache Web Server

For efficient and simple management of the Apache web server to the user - the resource owner must already have a number of useful files, which will be useful in customizing the server.

First, pay attention to the .htaccess file.

The file should be placed directives, perceive and process the web server when the action is in accordance with user preferences. Put the file. Htaccess in the root directory must Apache, then the directives are aimed at the entire Web server. If you need to work correctly specified subdirectory, then the file. Htaccess transferred there. Then specified file directives will detour directives root directory or any other higher level.

Note that this way of directives from the file. Htaccess goes downwards and not vice versa, and the changes will take effect immediately. This update rate is related to the fact that data from. Htaccess reread each time you access the Web server.

If necessary use the directive could not be realized and when loading the updated file. Htaccess produces errors, then most likely, this command simply prohibited for use on a virtual server. Cope with the error should help technical support provider.

On most hosting banned following directives: php_value, php_flag and options. Their change is possible only through the server management console.

Second, manage the Apache web server simplifies index files.

These files are opened on the server does not appeal to a specific page in a folder, and in general to the directory resource. To index include files with names index.shtm, index.htm, index.html and index.php. To change the priority of opening index files and making additional names DirectoryIndex newindex.php add the command to an existing file. Htaccess.

Third, using the file. Htaccess can manage ban access to certain files a web server, as well as the general prohibition set through command deny from all. With this scenario, the server side will continue to use files.

To open a specific file access with stable visitor ip, enter the following line:

Order Deny, Allow

Deny from all

Allow from

Then all users except the owner IP access to data will be banned.

How to open access, you can use the domain name:

Order Deny, Allow

Deny from all

Allow from.

Fourth, you can change the standard coding resource pages.

With line AddType "text / html; charset = koi8-r". Html. Htm. Shtml file. Htaccess you can set the command to automatically distribute documents posted on this site, in the encoding koi8-r instead of the default server specified windows-1251 .

Then the client's browser while loading the page will include information about the changed coding.

If the site is used html-documents with different encodings, including UTF-8, Windows-1250, Windows-1252 and ISO-8859-1, it can and does disable the forced extradition headers in windows-1251. It is possible to add a line: AddDefaultCharset Off.

In this case, each individual page will be spelled out in the tag encoding.

Fifth through. Htaccess can install their own error pages.

For this file to the command line you must enter the standard errors, such as 403 - Access to the site is denied, 404 - page does not exist 500 - Error request to the server. Is responsible for this directive: ErrorDocument 404 / pagenotfound.html.