What is extension in URL?
Extension simply means the type of file.
Extension is added at after the end of file name and it helps to identify us on which computer language it is written on.
For example, index.php, index.html as we are only talking about html and php.
In the year 2020, you probably want to have a SEO friendly website link and also which easy to remember.
Extensions like .html, .php can create mess sometimes and show your visitors 404 error page if they forget to add .html or .php at the end of the URL.
It might look good when you get visitor directly on your website but its hard for visitors to remember links with extensions.
We got a few question asking how to remove .php, .html extension from URL using .htaccess.
We have made it very simple for you and you can remove it easily.
1) Login into Control Panel.
2) Go to file manager
3) Settings and check on “show hidden files(dotted)” (Skip this step if you are not using cPanel)
4) Edit .htaccess and enter the code mentioned below depending upon your file extension
5) Save the file and you have successfully removed extension from URL.
1) Open FTP client (filezilla or any other)
2) Login into FTP using FTP details.
3) Locate to root directory (normally public_html)
4) Download .htacess file if present and open in text editor (eg notepad++)
5) Add the below code depending upon the extension you want to remove.
6) Save file and upload it on server. (It will show “replace” option if you have .htaccess file already)
7) Done.
1) Connect to your server via ssh (using putty or any other ssh client)
2) Navigate to public_html of your domain.
3) “nano .htaccess” to edit file using file editor.
4) Paste the code and press “Ctrl + C”
5) Open to save will show, click “y” and press enter.
6) Done
Remove .php extension from URL
The below code will remove .php extension from the end of file.
For example, https://hostathash.com/blog/conact.php will become https://hostathash.com/blog/contact
#Remove .php extension
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L] Remove .html extension from URL
The below code will remove .html extension from the end of file.
For example, https://hostathash.com/blog/conact.html will become https://hostathash.com/blog/conact
#Remove .html extension
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L] Once you have added the code in your .htaccess, your extension will be remove and your website will be SEO friendly and also it will be easy for users to remember links.
Server Error (500) when trying to access the Cyberpanel If you are getting this error while accessing the cyberpanel, there…
How to connect git with DirectAdmin Login into SSH and run the following command to create a new key pair…
How to host next js app in cpanel Login > Setup Node.js App > Create Application Enter the values shown…
Update via PHPMYADMIN: Disable Captcha : UPDATE tblconfiguration SET value = '' WHERE setting = 'CaptchaSetting'; Update WHMCS link: UPDATE…
3dsecure Access Denied Affiliates Affiliates Signup Announcements Banned Configure Products Downloads Downloads Denied Error Login Logout Password Reset Ticket Feedback…
Export Database via SSH mysqldump --routines -u databaseusername -p databasename > database.sql Import Database via SSH mysql -u databaseusername…