Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Create and use a .htaccess and .user.ini file
This guide provides basic instructions for creating and using a .htaccess
and .user.ini
file with an Web Hosting Infomaniak.
Preamble
- A
.htaccess
file is placed at the root of a website and allows you to configure the Apache HTTP server.- As a decentralized configuration file, it offers significant flexibility to adjust the server's behavior according to the specific needs of the site.
- This file allows you to define URL rewrite rules, impose access restrictions, manage HTTP errors, and even customize security aspects such as disabling the display of files/folders.
- It also facilitates the implementation of redirects and aliases, thus providing precise control over the organization and accessibility of the site.
- A
.user.ini
file allows you to customize the PHP directives of the folder (and its subfolders) in which it is located.- By acting at the PHP interpreter level, this file allows you to define specific configurations for a given folder and its subdirectories.
- With its clear syntax, it offers the possibility to modify various parameters such as memory limit, script execution time, error handling, and other PHP-related directives.
- This granular approach allows developers to finely customize PHP behavior according to the specific requirements of each section of the site.
Create a file…
… .htaccess
- Log in to your hosting via FTP or SSH.
- At the root of the relevant website, create a new file and name it:
.htaccess
. - Enter the desired directives in the file; refer to these other guides for example:
… .user.ini
- Log in to your hosting via FTP or SSH.
- In the desired location, create a new file and name it:
.user.ini
. - Enter the desired PHP configuration parameters in the file.
⚠️ Modifying the .user.ini
file takes several minutes to take effect.
Link to this FAQ: