youtube SEO, tricks for blogger, wordpress tricks for earning money online youtube earning, whatsapp,windows, android & all about new technology.

Hide .php, .html extension in url with .htaccess

No comments

Hide .php .html url extension from your web url by using .htaccess , without extension url is called seo friendly url.

Example-

Before Hide Extension url look like below:

http://example.com/contact.php.
http://example.com/about.php.

After using .htaccess trick for hide extension:
Above url will show like below url in browser address bar
http://example.com/contact
http://example.com/about

Hiding file extensions by editing in .htaccess
Login in your cpanel >> Go to File Mananger >>



In file manager you will see .htaccess file press right click on .htaccess now click on edit option.



How to hide php extension in the url

For hide .php extention from your web url add below code in .htaccess file.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

How to hide html extension in the url

For hide .html extention add below code in .htaccess file.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

Now when you add your other webpage link remove the extension from link

Example-

Suppose your website is http://example.com you want to add about page link
Do not add like this  <a href=http://example.com/about.php>about</a>
Add like this  <a href=http://example.com/about>about</a>
Add link without page extension.