Removing file extensions using htaccess
In this Post We Will Explain About is Removing file extensions using htaccess With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to How to remove .php, .html, .htm extensions with .htaccess Example
In this post we will show you Best way to implement remove .php, .html, .htm extensions using .htaccess, hear for How to Remove php, html Extension from URL using htaccess with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.
htaccess – How to remove .php, .html, .htm extensions with .htaccess
we are going to learn you how to step by step remove .php extensions, .html extensions and .htm extensions using .htaccess file.
Remove .php, .html, .htm Extensions
To remove the simple.php extension from a core PHP file as an example Like as a www.Pakainfo.com/my-page.php to www.Pakainfo.com/my-page we have got to feature the some subsequent code within the put .htaccess file
RewriteEngine On RewriteCond % !-f RewriteRule ^([^\.]+)$ $1.php [NC,L]
If we would like to some get rid of the any extension like as a .html extension from a simple HTML file as an example like as a www.Pakainfo.com/my-page.html to www.Pakainfo.com/my-page we just ought to alter the last simple line from the source code higher than to simple last step match the computer new filename
RewriteRule ^([^\.]+)$ $1.html [NC,L]
we shall currently link simple root pages within the any HTML document without some having to data feature the new extension of the page.
<a href="https://www.pakainfo.com/my-pages" title="my-pages">NAME-OF-LINK</a>
Adding a trailing slash at the tip
We received several some htaccess requests asking a second way to put a trailing slash at the some tip. Ignore any data the primary piece and near add insert the subsequent source code.
The primary four simple lines modify the removal some extension like as a .html .php as well as .htm of the extension and so the following, with the addition futures of the trailing slash related SEO and redirecting.
Link to the DOM HTML as well as PHP file as shown higher more than. Don’t forget to simple line alter the source code if we would like it changes applied to associate simple HTML file.
RewriteEngine On RewriteCond % !-f RewriteRule ^([^/]+)/$ $1.php RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php RewriteCond % !-f RewriteCond % !-d RewriteCond % !(\.[a-zA-Z0-9]|/)$ RewriteRule (.*)$ /$1/ [R=301,L]
Note For GoDaddy User
Attention For GoDaddy users onlytherefore as to simple get rid of the any extensions We wish to modify add some source code htaccess file to MultiViews before.
The code ought to appear as if this
Options +MultiViews RewriteEngine On RewriteCond % !-d RewriteCond % !-f RewriteRule ^([^\.]+)$ $1.php [NC,L]
If We are disquieted that data search engines may some index these pages as any copy or duplicate data content, ne had tag w pu a canonical meta tag in your simple HTML head secotions
<link rel="canonical" href="https://Pakainfo.com/my-page/users-data">
I hope you have Got What is How to remove .php, .html, .htm extensions with .htaccess And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.