How To Remove PHP Extensions From Your Hostinger Website Using An Htaccess File
November 9, 2020 No Comments Tutorial rhalp10If you're looking to enhance the appearance and functionality of your Hostinger-hosted website, removing the .PHP extension from your URLs can give it a cleaner and more professional look. In this article, we will provide you with a basic guide on how to achieve this using an .htaccess file. Let's get started!
Step 1: Accessing your hosting panel
To begin the process, log in to your Hostinger account and navigate to your hosting panel. Once you're there, you're ready to move on to the next step.
Step 2: Opening the File Manager
Within the hosting panel, locate and click on the "File Manager" option. This tool allows you to manage all your website files effortlessly. It's a powerful feature that simplifies the process of removing the .PHP extension. So, let's proceed.
Step 3: Locating the "public_html" folder
Upon entering the File Manager, you will see a list of folders and files relevant to your website. Your next task is to find and open the "public_html" folder. This is where your website's main files reside.
Step 4: Creating the .htaccess file
To remove the .PHP extension, you need to create an .htaccess file within the "public_html" folder. In the File Manager, look for the option to create a new file. When you click on it, a pop-up modal will appear. In the text field, enter ".htaccess" (without the quotes) as the file name. Press the enter key to proceed.
Step 5: Adding the necessary configuration
With the .htaccess file created, you now need to open and edit it. Locate the file within the "public_html" folder, right-click on it, and choose the "Edit" option.
Inside the .htaccess file, you will need to paste the following configuration:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*.php$ %{REQUEST_FILENAME}.php [QSA,L]
This configuration tells the server to rewrite the URL for any requests that do not end in .php, redirecting them to the corresponding PHP file.
Once you've pasted the configuration, click on the "Save & Close" button. Congratulations! You've successfully added the necessary rules to your .htaccess file.
Conclusion
In this article, we've provided you with a simple and effective guide on how to remove the .PHP extension from your Hostinger-hosted website using an .htaccess file. By completing the steps outlined above, you can give your website a more professional and streamlined appearance. Remember to always exercise caution when editing important files like the .htaccess file and make sure to create backups before making any changes.
Now that you have the necessary knowledge, why not go ahead and implement this change on your Hostinger website? Enjoy the improved aesthetics and SEO benefits that come with cleaner URLs!