Tuesday, December 14, 2010

Working with. Htaccess

What is the. Htaccess? Gathering in the address bar of your browser, you get to your computer files, which displays the browser. Control which files and how you show (forward) has a web server. The most popular two servers: IIS and Apache. As with any program, a web server has certain settings. But, you as a user of Apache can (and probably will not, if we talk about virtual hosting) the right to change the configuration of Apache via its main files that apply to all users on this server. But, you can change some configuration files, which distribute the action only on your site. One of these files -. Htaccess This flexible configuration file Web server Apache. "Flexible" means that once you change something in this file, the changes immediately take effect. With it you can override many of the directives from the file httpd.conf (this file is the main Apache server configuration file, and it applies fully to all users of this Apache copy). In cases where you do not have access to the Apache configuration file (the same virtual hosting), you will help this particular file. This file is not available to the user of the Web browser. If. Htaccess file is located in the root directory of the server, then it applies to the entire server, except those folders where the other file. Htaccess (and in addition to all folders "below" the folder with the second. Htaccess). Example: The structure of your directories on the server is as follows:
|-user
| |
|  -user1
|        |
|         -user2
|
|-data
| |
|  -data1
|      |
|       -data2
|

Directory user1 and user2 will be attached to the directory user. If we put the file in the directory www. Htaccess, then its effect will automatically apply to the directory user1 and user2. In the directory data put another file. Htaccess, in comparison with what is in the directory user. And for directories data1 and data2 will act file. Htacsess, located in the data.

Now, in the directory user2 we put another file. Htaccess, which is different from what is in the directory 2mya levels above (this is the directory user). As a result, the settings for the directory user2 would be determined only by the file. Htaccess, which is located in this directory.
As often Apache is configured so that always looks for this file in the directory, then. Htaccess will help you quickly and without shutting down the server to make it re-installing.
===
[Contents]
Syntax. Htaccess That mandatory syntax, failure of which leads to errors in the server: - Paths to files (directories) are specified from the root server. Example: / opt / home / www.astanafoto.com / htdocs / config / .htpasswords
- Domains, indicating protocol
Example: Redirect / http://www.site.ru
The file has a name it is "point" htaccess Must be written in UNIX-format. For the shell FAR, reached F4 (editing the file), Shift + F2 (select "save as UNIX-text").

1 comment:

  1. Good information and a much needed one that can be used in it.

    ReplyDelete

Confused? Feel free to ask

Your feedback is always appreciated. I will try to reply to your queries as soon as time allows.

Note:
Please do not spam Spam comments will be deleted immediately upon my review.