How to change a file extension

Overview

You can change or remove a file's extension on your DreamHost server — for example, to turn phpinfo.php.txt into phpinfo.php, or php.ini into phprc — using an FTP client (rename) or SSH (the mv command). This article explains both methods. For example, if you create a text file on your computer, it's saved with the extension of .txt

If the file needs to be a phpinfo.php, .htaccess, or phprc file, the extension must be changed or removed. This article explains how to adjust the file extension.

This article assumes you have already created or uploaded the file to your website at DreamHost. View the following articles for instructions on how to upload your file or create it on the server:

How do I change the extension in FileZilla?

These instructions assume you've uploaded the file to DreamHost using the links above. Once the file is on the server, log in using an FTP client such as Filezilla.

Right click on 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.

How do I change the extension via SSH?

These instructions assume you've uploaded the file to DreamHost using the links above. Once the file is on the server, log in using your Shell user:

Once you have logged into your server via SSH, navigate to the location of the file. You can then rename the file to remove the extension. For example, the following command changes a file titled from phpinfo.php.txt to phpinfo.php:

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

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

[server]$ mv php.ini phprc

You can then run ls -la to confirm it's been renamed:

[server]$ ls -la

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?