Depending on the server setup and access you have, you can use a variety of techniques to copy the public_html folder from one server to another. Here are a few common approaches:
Using SSH and SCP:
- Open a terminal or command prompt on the destination server
- Use the following command to copy the folder from the source server to the destination server: scp -r user@source_server:/path/to/public_html /path/to/destination_server
- Replace ‘user’ with your username, and ‘source_server’ with the IP address or domain name of the source server.
- When prompted, enter the source server’s password.
- The folder will be copied to the destination server’s given location.
- Install FileZilla or another FTP client on your local system.
- Using the source server’s IP address or domain, username, and password, connect to the server.
- Navigate to the public_html folder on the source server.
- Using the destination server’s credentials, connect to it in a different FTP client window or tab.
- Navigate to the public_html folder on the destination server.
- Drag and drop the files from the source server’s public_html folder to the destination server’s public_html folder in the FTP client.
If your project has already been deployed on GitLab, you can use the Git version control system to clone the repository to the destination server. Here is a detailed instruction.
- Access the destination server via SSH. Open a terminal or command prompt. ssh username@hostname
- Go to the location where you wish to clone the public_html folder for the project. For instance. cd /path/to/destination/public_html
- Initialize a new Git repository in the destination directory. git init
- Set up the remote repository URL for your GitLab repository. Replace <repository_url> with the URL of your GitLab repository. git remote add origin <repository_url>
- Fetch the contents of the remote repository. git fetch
- Checkout the branch or commit that you want to clone. If you’re unsure, you can use the master branch as an example. git checkout master
- Copy the files from the .git directory to the current directory. cp -r .git/*.
- Reset the copied files. git reset
- The target directory should now contain the project’s public HTML folder after you’ve completed these procedures.
Sreyas is a prominent software and mobile app development firm, boasting extensive expertise in UI/UX design. Our global presence allows us to offer a comprehensive range of services, including data migration, database management, web hosting, infrastructure management, and more to clients worldwide.