How to hide .php or html in htaccess hostinger

To hide the .php or .html extensions in the URL of a website hosted with Hostinger, you can use the .htaccess file. The .htaccess file is a configuration file that allows you to control various aspects of how your website functions, such as redirects, error handling, and URL rewriting.

Steps to hide .php in htaccess hostinger

To hide the .php or .html extensions using the .htaccess file, follow these steps:

  1. Access the file manager in the HPanel control panel.
  2. Navigate to the root directory of your website.
  3. If you don’t see a .htaccess file, create a new file and name it .htaccess.
  4. Open the .htaccess file and add the following code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

This code will hide the .php extension from the URL, so that your website’s URLs will appear as “www.example.com/page” instead of “www.example.com/page.php”.

Steps to hide .html in htaccess hostinger

To hide the .html extension, you can use similar code:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

Keep in mind that hiding the .php or .html extension from the URL can have some technical implications, such as the need to update any links or references to your website’s pages. It’s a good idea to test your website thoroughly after making these changes to ensure that everything is working as expected. If you are not familiar with .htaccess or URL rewriting, it may be a good idea to consult with a web developer or the customer support team at Hostinger for assistance.