buy tb500

How do .htaccess files work in Plesk?

Programs in Linux, such as Apache (the server daemon) and qmail (the mail daemon) are configured using basic text files instead of the centralized-database (registry) used in Windows. This provides advantages in that the configuration for any domain can be distributed among many files.

Apache’s configuration by Plesk is split into four parts:

  • httpd.conf This is the master file and contains all the general and default settings for the whole server and all domains. Here items such as file types and which features are loaded are configured. This file isn’t normally written to by Plesk and therefore allows us to tune the servers.
  • http.include Written to by Plesk, this file configures the default settings for all the IP addresses the server uses as well as creating the general subdomains and (for Horde webmail and Mailman mailing-lists respectivly).
  • conf/httpd.include Found under each domain’s home folder, it contains the settings specific to each domain, including subdomain and Web User settings.
  • .htaccess Not required for a site to work, these files allow configuration of the server on-the-fly by storing settings within an actual folder. Settings in these files apply to the folder the file is in and any sub-folder.

The first three types are managed by us and Plesk and therefore are difficult to update and change settings for specific area of a website. By using .htaccess you can work with Apache and change some of the settings by yourself.

Why do I need to use it?

Most of the time you probably won’t need to use a .htaccess file. The default settings for a domain are more than enough to run a website, and some of the more advanced settings, such as switching on and off PHP, Python, etc. or the Custom Error Documents option can all be controlled by Plesk.

However, there are times and people that will need to use them in order to change advanced settings not supported by Plesk. For example, (at the time of writing) all stable versions of osCommerce still require the register_globals setting enabled within PHP. This is generally unsafe and not recommended (click here for more information about the setting).

Normally, the only way to enable the setting it to change the php.ini file, which configures PHP for the whole server. But, using features of the PHP module in Apache, you can write a command into a .htaccess file which enables the setting for either the whole domain (if put into the Document Root) or just the directory that holds osCommerce.

So what can I do with it?

You can’t do everything with it. There are a number of options and settings in Apache that can only be managed either with just the httpd.conf file, or both httpd.conf and the httpd.include files. But, you can control things like access rights, type definistions and PHP settings.

Thank you

Leave a Reply