How to remove extension in url through (.htaccess) file
Removing extension from urls have advantage that it's hide the backend technology from end users.
First step is to create a .htaccess file on your document root and write these codes to remove file extensions.
Your current url look like this :
You need to change the url on your document from http://yoursite.com/demo.php to http://yoursite.com/demo
and write these codes in .htaccess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.php [NC,L]
Now turn on the rewrite_module of your Server.
Now, Your Url is changed and it look like :
That's it! hope you guys like this post and please don't forget to share.


No comments: