Articles on: Files Management
This article is also available in:

How to change the extension of a file via FTP or SSH?

Sometimes it might be necessary to change a file extension to make sure it works as intended. For example, if you create a text file on your computer, it is saved with the .txt extension.

If the file should be a phpinfo.php file, . htaccess, or other, the extension must be modified or removed. This article explains how to adjust the file extension via FTP or SSH.

File extension change in Filezilla



These instructions assume that you have downloaded the file to the server hosting your site. Once the file is on the server, connect using an FTP client such as Filezilla.

Right-click the file and choose 'Rename'. Edit the file to remove the .txt extension. Click 'Enter' and the file is immediately saved with the new extension.

Change file extension via SSH



These instructions assume that you have downloaded the file to the server where your site is hosted. Once the file is on the server, log in by using your SSH access.

Once connected to your server via SSH, navigate to the file location. You can then rename the file to remove the extension. For example, the following command changes a file named phpinfo.php.txt to phpinfo.php:

[server] $ mv phpinfo.php.txt phpinfo.php

This example shows how to remove the extension while renaming it:

[server] $ mv php.ini phprc


You can then run ls -la to confirm that it has been renamed:

[server] $ ls-la

Updated on: 20/02/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!