How To Remove PHP Extension From URL Using .htaccess

How To Remove PHP Extension From URL Using .htaccess

A user-friendly URL is the best way to improve search engine ranking also preferred by the search engines, so when we develop a website in PHP and with other technology they show their extension in URLs which is not good practice, so we can remove it and make it user-friendly URLs by removing their extension. So if you want to know “How to Remove PHP Extension From URL” and make is user-friendly URLs then follow these tips.

What are the User-friendly URL and Non-Friendly URL?

Let’s take an example you have created a website in PHP and you have created a page (These are not Userfrienldy URLs)

User-friendly URLs: A user friendly URLs are those URLs which looks clean and extension are removed from the URLs, if you will use a content management system to create,  then offer SEO friendly and clean URLs, but if you will PHP and other technology to develop your website then they add extension file name in the URLs who spoil the user experiences.

User-friendly URLs Example: 

Guide How To Remove PHP Extension From URL (cPanel Guide)

Follow these steps to Remove PHP Extension From URL:

  1. Login to your cPanel account.
  2. Go to File Manager in the FILES Section area
  3. In the File Manager go to the Settings button on the top right corner
  4. On the Preferences window that will appear to check the Show Hidden Files (dotfiles) option. Click the Save button to apply the settings.
  5. Now navigate to the .htaccess file. If the file doesn’t exist you will need to create it.
  6. Click the Edit button from the File Manager top menu.
  7. Add the below lines to the .htaccess file. Click the Save Changes button and then the Close button.
  8. Now apache server will remove.PHP extension from URLs and your website URLs will look clean and user-friendly

How To Remove PHP Extension From URL (Localhost Guide)

  • Start your Xampp server, Apache server
  • Click on explore from Xampp server
  • Find your project folder and create htaccess.txt files in the root folder
  • Suppose your project folder is http://localhost/php
  • Then create htaccess.txt in root folder and place


Please enter your comment!
Please enter your name here