Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
This guide provides basic instructions for creating and using an .htaccess
and .user.ini
file with an Infomaniak Web Hosting.
The Differences
.htaccess
An .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 rewriting 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 offering precise control over the organization and accessibility of the site.
.user.ini
A .user.ini
file allows you to customize PHP directives for the directory (and its subdirectories) where it is located.
Acting at the PHP interpreter level, this file allows you to define specific configurations for a given directory 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 These Files
.htaccess
- Connect to your hosting via FTP or SSH
- At the root of the relevant website, create a new file and name it:
.htaccess
- Add the desired directives to the file, e.g.:
.user.ini
- Connect to your hosting via FTP or SSH
- In the desired location, create a new file and name it:
.user.ini
- Add the desired PHP configuration settings to the file
⚠️ Important: Modifying the .user.ini file may take several minutes to take effect.
This guide explains how to enable support for certain types of files (.inc
for example) by PHP on an Infomaniak Web hosting so that they are processed in the same way as a .php
file.
Extensions recognized by PHP
Previously, you had to add the following line to a .htaccess
file:
AddType application/x-httpd-php .inc
This prevented the file's content from being displayed as text instead of being correctly interpreted by PHP when accessed via a browser.
Now you can manage file extensions via the FPM Extensions field in your hosting Manager.
To add support for a specific file type:
- Log in to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Firefox
- Click on the icon at the top right of the interface (or navigate using the left sidebar menu, for example)
- Choose Hosting (Web & Domain universe)
- Directly click on the name of the relevant item in the displayed table
- Click on the name of the relevant site (in the Sites section)
- Click on the Advanced settings button
- Click on the Apache tab
- You will find the FPM Extensions field where you can add the desired extension
This guide explains how to initiate a content scan on a Web Hosting service to detect and clean files containing viruses and other malicious scripts that may threaten website security.
Start an Antivirus Scan of the Sites
To scan potentially infected content:
- Click here to access your product management in the Infomaniak Manager (need help?).
- Click directly on the name assigned to the relevant product.
- Click on Security in the left sidebar menu.
- Click on Antivirus in the left sidebar menu.
- Click the blue Scan button:
- Select the site(s) to scan.
- Click the blue Start Scan button.
The antivirus scan may take some time, but the Manager can be closed during the process.
You will receive an email when the operation is complete.
Also consider using the vulnerability detection tool to monitor any potential issues that are automatically resolved on your websites.
This guide covers the database management features available on Infomaniak servers.
MySQL, SQLite, MariaDB, PostgreSQL…
At the Database Management System level, Infomaniak servers support:
- MySQL databases via PHP MySQL access or via Perl DBI+DBD::mysql
- You can use MySQL as the database management system (DBMS) on Infomaniak servers.
- You can access it either through PHP using the built-in MySQL database functions in PHP or through Perl using the DBI and DBD::mysql modules.
- MySQLI, the native access interface to MySQL (PHP5)
- MySQLI is a PHP extension that allows access to a MySQL database.
- It is an improved and more recent version of the old MySQL extension in PHP, offering enhanced features and performance.
- SQLite 3.x
- SQLite is a lightweight, standalone, serverless SQL database engine.
- Infomaniak servers support SQLite version 3.x, which means you can use SQLite to store data on these servers.
- MariaDB
- MariaDB is a fork of MySQL and is often used as an alternative to MySQL.
- You can therefore use MariaDB as the database management system on Infomaniak servers.
- the PGSQL module
- PGSQL is a PHP module that allows you to connect to a PostgreSQL database.
- This specific functionality allows you to connect to a REMOTE PostgreSQL database via PHP; this requires opening the appropriate port to the specific IP of the PostgreSQL database from the Infomaniak manager.
‍
This guide explains how to enable or disable the PHP function set_time_limit
for a Web Hosting.
Introduction
set_time_limit
is a PHP function that sets the maximum execution time of a script in seconds. If this limit is reached, the script is terminated and a fatal error is returned.
set_time_limit
cannot be used to set values beyond the script execution time limit (max_execution_time) set in the Manager.
Enable or Disable the PHP Function set_time_limit
To modify the PHP configuration:
- log in to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Firefox
- click on the ‍ icon in the top right corner of the interface (or navigate using the left sidebar menu, for example)
- choose Website (the Web & Domain universe)
- click on the name of the relevant object in the displayed table
- click on the Advanced Settings button
- click the toggle button On/Off as desired (in the PHP tab)
- click the Save button to validate the changes
This guide explains how to back up or export a MySQL/MariaDB database via the Infomaniak Manager or through SSH.
Exporting a Database via the Manager
To export an Infomaniak database:
- Log in to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Firefox
- Click on the icon at the top right of the interface (or navigate through the left side menu, for example)
- Choose Hosting (universe Web & Domain)
- Click directly on the name of the relevant object in the displayed table
- Click on Databases in the left side menu
- Click on the action menu â‹® on the right of the relevant object in the displayed table
- Click on Export (the default options are suitable for most situations)
Exporting a Database via SSH
If you are unable to export the database via the console or if the database is large:
- If necessary, create an SSH FTP account (learn more)
- Connect to the hosting server via SSH (learn more)
- Adapt and execute the following SSH command: mysqldump --host=your_mysql_server -u your_mysql_user --password=your_mysql_user_password database_name --no-tablespaces > backup.sql
- Wait for the SSH command to execute (the terminal may freeze for a few seconds)
- Connect to the server via FTP software (learn more)
- Download the generated SQL file
Additional Help
- Example command to be executed in step 3 of the second procedure: mysqldump --host=fhzc.myd.infomaniak.com -u lfcz_test --password=mypassword lfcz_test --no-tablespaces > backup.sql
- Get information related to the MySQL server, username, and database password
This guide explains how to update web applications automatically installed via WordPress & Infomaniak Apps.
Updating an Application Installed via Infomaniak
To access web hosting in order to update an application:
- Log in to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Edge.
- Click on the icon at the top right of the interface (or navigate through the left side menu, for example).
- Choose Hosting (Web & Domain universe).
- Click on the name of the relevant object in the displayed table.
- Click on My sites in the left side menu.
- Click on WordPress & Apps in the left side menu.
- Click on the Update button (if the button is not available, it means the update is not yet available).
Important: If an application is manually updated via FTP, it is then impossible to update it via the Manager and benefit from automatic updates.
It is also possible that during the installation of your Web Application, automatic updates (at least security updates) were activated:
This guide explains how to install technologies, software, and applications (non-exhaustive list below) with just a few clicks on Cloud Server. Other technologies can be installed (click here).
Install (or uninstall) an application
To find the list of applications and proceed with their installation:
- Log in to the Infomaniak Manager (manager.infomaniak.com) using a web browser such as Brave or Firefox
- Click on the icon ‍ at the top right of the interface (or navigate using the left sidebar menu, for example)
- Select Cloud Server (in the Web & Domain universe)
- Click on the name of the relevant object in the displayed table
- Click on Fast installer in the left sidebar menu
- Click on the action menu â‹® to the right of the application you want to uninstall in the displayed table
- Click on Uninstall
- Otherwise, click on the blue button Install an application to make your choice
Non-exhaustive list of available apps
- AdvanceCOMP
- BuildEssential
- electron_dev
- ExifTool
- FFmpeg
- Ghostscript
- Gifsicle
- GraphicsMagick
- HAProxy
- Imagemagick
- Jpegoptim
- libjpeg_turbo
- libqrencode
- libX11_xcb1
- MidnightCommander
- Memcached
- mongoDB
- NVM Node Version Manager
- OptiPNG
- p7zip
- PDFtk
- pip
- Pngcrush
- Pngquant
- Redis
- RRDTool The Round Robin Database Tool
- RubyCompass
- systemd
- tesseract_ocr
- varnish
- virtualenv
- WebP
- xauth
- xpdf
- xvfb
- ZSH
This guide explains how to display the IP address of a site on your Web Hosting.
The IPv4 address is generally the same for all sites on the hosting (unless you have acquired a dedicated IP).
Display Your Site's IP Address
Starter Offer - Basic Web Page
The IP address is specified on the Starter hosting management page:
- Log in to Infomaniak Manager (manager.infomaniak.com) from a web browser such as Brave or Edge
- Click on the ‍ icon in the top right corner of the interface (or navigate using the left-hand side menu, for example)
- Select Hosting (within Web & Domain)
- Click on the name of the relevant object in the displayed table
- Click on More Information (in the Information section)
- The IPv4 address is displayed on the page
Paid Web Hosting
The IP address is specified on the website management page of the web hosting:
- Log in to Infomaniak Manager (manager.infomaniak.com) from a web browser such as Brave or Firefox
- Click on the ‍ icon in the top right corner of the interface (or navigate using the left-hand side menu, for example)
- Select Website (within Web & Domain)
- Click on the name of the relevant object in the displayed table
- The IPv4 (and IPv6) address is displayed on the page
URL rewriting on the fly is a technique designed to modify the apparent name of Web pages but where the change is actually achieved simply by virtual redirections from the new (visible) name to the old name (invisible to the visitor). The name of the page does not therefore change per se.
This generally helps to give pages a "cleaner" name, e.g. by hiding URL parameters passed to dynamic web pages. It is then no longer possible for anyone to see that you are using dynamic pages with extended URLs. Not only does it look better for the visitor, but it is of particular benefit when it comes to your pages being indexed by Web searches, as the latter generally exclude URLs with too many parameters.
Actions to be carried out
1. Page name rewriting
We could transform the following Web page URL "article.php?id=25&category=4&page=3" into "article-25-4-3.html", or indeed "title-article-25-4-3.html". Here is the content to place in your .htaccess file to do this, assuming that the article.php file is located in the web/admin/ server directory.
Options +FollowSymlinksRewriteEngine onRewriteBase /admin/RewriteRule ^article-([0-9]*).([0-9]*).([0-9]*).html$ article.php?id=$1&categorie=$2&page=$3 [L]
The "Options +FollowSymlinks" line allows symbolic links to be followed and is not always needed.
The "RewriteEngine on" line enables the Apache mod_rewrite module, i.e. enabling URL rewrites.
The "RewriteBase /admin/" line allows you to specify once and for all the directory to which the following files will apply (article.php, etc).
The "RewriteRule" line, which may seem a little more complex, must be added for every URL you wish to rewrite.
In our example, we have just one line, made up as follows:
The initial "^" character indicates the start of a virtual file name that we wish to redirect.
The "$" character following the ".html" denotes the end of this virtual file name.
Each "([0-9]*)" group is based on regular expressions and indicates that a series of numbers from 0 to 9 will be present and then picked up and placed in the corresponding "$1", "$2" and "$3" variable which can be found at the end of the line.
The "[L]" sign indicates the end of a line, and hence the end of the rewrite rule for this item.
So when a visitor to your site asks for the page "article-25-4-3.html", the .htaccess file will then automatically redirect the request to "article.php?id=25&category=4&page=3" without the user noticing.
Warning: even if your URL rewrite rules are in place and working correctly, it will still be possible to access your pages using the old parametrised URL. Be sure therefore to check that all links to your site have been correctly modified to use the new format.
To create more complex rewrite rules, please refer to the Apache documentation on URL rewrites.
2. Permanent redirection to a second domain
If you own more than one domain for a single website and wish to publish them all, you have the option of redirecting all page requests to another domain, so as to keep your main domain visible in the browser address bar. For example, if "www.mydomain.xyz" and "www.my-domain.xyz" both point to the same website and the former is the main domain, here is the content of the .htaccess file to install in the first site's root directory:
RewriteEngine OnRewriteRule ^(.*)$ http://www.my-domain.xyz/$1 [R=301]
This rule will thus retrieve the name of every page under "www.mydomain.xyz" and open it at "www.my-domain.xyz", completely transparently to the user. [R=301] means permanent redirection.