DEV Community

Cover image for Remove PHP extension from URL using htaccess
joshua-brown0010
joshua-brown0010

Posted on

Remove PHP extension from URL using htaccess

User-friendly URLs show a great impact and reputation of your web pages or web address. For example, www.kodlogs.com is easier to understand by users not familiar with a backend or codding language rather than your address looks like www.kodlogs.php.com . to make our pages URL or sites user friendly we need to make some changes in .htaccess file. In this topic, you will learn a full guide to how to change or remove file extensions of webpages.

Method to remove file extensions from the webpage

Web File/page extension can be removed by changing or adding few lines of code in the “.htaccess” file. This an ASCII file you can edit it and can change easily the configuration. the most important thing is that .htaccess is the file and not the file type or extension. You can make changes in this file either by cPanel access or if your file is a local server in the system you can also find and change settings.

How to change .htaccess in cPanel

Here are some steps you need to follow to find and make changes in the .htaccess file.

  • First, you need to login into the cPanel account.·
  • After logging in go to FILES section file manager.
  • On the top right corner of the Panel click the setting icon to open the setting.
  • On the preferences window that will appear enable the option of view hidden files and save to apply changes made.
  • Here you will find the .htaccess file click It to open, in case if you cannot find or the file is not there you need to create the file.
  • On top Manu click edit.
  • Once the file open for editing, copy the following lines, and save the file by clicking save. Read more

Top comments (0)