Changing the document root of your website can be necessary for various reasons, such as restructuring your site or launching a new version. This guide will walk you through the process of changing the document root on Cubes Hosting using Directadmin.
Understanding Document Root
The document root is the directory on your web server where your website files are stored. By default, it's often named 'public_html' or 'httpdocs'. Changing this setting affects where the server looks for your site's files.
Prerequisites
- Access to your Cubes Hosting Directadmin panel.
- Basic understanding of website file structure.
- Ensure you have a backup of your website files before making changes.
Step 1: Accessing Directadmin File Manager
Log into your Cubes Hosting Directadmin control panel and navigate to the File Manager. This tool allows you to manage and edit your website files directly.
Step 2: Locating the Configuration File
The configuration file that defines your document root varies based on your website setup:
- For Apache servers, it's typically a '.htaccess' file.
- For Nginx servers, you'll need to access the server block configuration files, often not accessible via Directadmin.
If you’re using Apache, proceed to edit the '.htaccess' file. For Nginx, you may need to contact Cubes Hosting support for assistance.
Step 3: Modifying the Document Root
In your '.htaccess' file (for Apache servers):
- Find the line that begins with 'DocumentRoot'.
- Change the path following 'DocumentRoot' to the new directory you wish to set as your document root.
- Save the changes and exit the File Manager.
Note: Be cautious when editing the '.htaccess' file, as incorrect settings can make your site inaccessible.
Step 4: Verifying the Changes
After making changes:
- Clear your browser cache and visit your website to ensure it's loading correctly.
- Check for any broken links or errors and address them as needed.
Conclusion
Changing the document root of your website can be done efficiently through the Directadmin control panel on Cubes Hosting. Always ensure that you have a backup of your site and verify the website functionality post-change. If you encounter any issues, revert the changes using your backup and consult with Cubes Hosting support.