Best Blogger tutorials and Tech Tricks website.

Monday 5 November 2018

REMOVE .php and .html extension from website url

1 comment

There are lots of questions that go into RICHY </ > Technical, about how to remove the .php and .html extensions on the website .
One easy way you can do is to edit the .htaccess file on hosting. Editing .htaccess files can be done via cPanel or Plesk, via the file manager and then click edit on the .htaccess file.
Following are the steps:
  1. Remove the .php extension Use the following script to replace the .php extension
    "RewriteCond% {REQUEST_FILENAME}. Php -f"
    this command works to find the .php file
    "RewriteRule ^ (. *) $ 1.php"
    This command works to delete files with the extension .php
  2. Remove the .html extension Use the following script to replace the .html extension
    "RewriteCond% {REQUEST_FILENAME} .html -f"
    this command works to search for .html files
    "RewriteRule ^ (. *) $ $ 1.html"
    This command works to delete files with the extension .html
For additional information, the above script sometimes cannot be used on some CMS such as WordPress or Website Builder like Weebly, because it has its own .htaccess structure or changes in extension from the permalink side.
So the guide to removing the extension .php and .html with .htaccess , hopefully useful.

1 comment :