TechnoKida is Technology and Social Media Blog Platform. We write blog about Web Development Tutorial, Social Media and Trending Updates to help people who want learn Online.

How to hide HTML PHP extension from URL Using .htaccess

Are you working with HTML or PHP and want to hide HTML PHP extension from URL, This article is perfect for you. It makes your website more SEO friendly. I’ll show you how to do that easily, by editing the .htaccess file.

How to Hide HTML PHP extension

.htaccess file allows you to hide extension.
.htaccess is a configuration file for use on web servers running the Apache Web Server software.



1. Hide PHP Extension

To remove the .php extension from a PHP file for example mywebsite.com/page.php to mywebsite.com/page
you have to copy/paste the following code inside the .htaccess file or if you do not have .htaccess file then create new file copy below code and paste in the file ans save with .htaccess file and upload it on server root directory.

# Turn on the rewrite engine
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]


2. Hide HTML Extension

To remove .html extension from html file for example mywebsite.com/page.html to mywebsite.com/page
Just replace last line of the code.

# Turn on the rewrite engine
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

More: There is one online tool also available to create .htaccess online.


Please let us know your views in comment section below and read our other PHP/WordPress articles.

5 comments:

  1. Recently, I have commenced a blog the info you give on this site has encouraged and benefited me hugely. Thanks for all of your time & work. hide wp login path

    ReplyDelete
  2. Bathing your pet often is important to help lessen allergic reactions they may cause. Pet dander (skin flakes) and saliva on your pet's fur can cause allergies. Pets can often bring in allergens from outside the home into your home, too.play bazaar satta king

    ReplyDelete
  3. This is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: hide my wp

    ReplyDelete
  4. Very nice article, I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks!. hide my wp

    ReplyDelete
  5. Very useful info. Hope to see more posts soon!. Hide WordPress plugin

    ReplyDelete