Knowledge base

1000 FAQs, 500 tutorials and instructional 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 Infomaniak Web Hosting.

 

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 setup 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.
    • Thanks to 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 the behavior of PHP according to the specific requirements of each section of the site.

 

Create a file…

 

.htaccess

  1. Connect to your hosting via FTP or SSH.
  2. At the root of the concerned website, create a new file and name it: .htaccess.
  3. Write the desired directives in the file, refer to this other guide for example.

 

.user.ini

  1. Connect to your hosting via FTP or SSH.
  2. At the desired location, create a new file and name it: .user.ini.
  3. Write the desired PHP configuration parameters in the file.

Modifying the .user.ini file takes several minutes to take effect,


Has this FAQ been helpful?