Remapping subdirectories can be useful when either re-structuring your site or giving access to other users to alter specific subdirectories without needing to give them full access to the site. By using this feature, users have subdirectories of their sites use non-standard locations within the file structure as a new source for web content.
- You cannot use the remap subdirectory service to change the web directory for an entire domain. To change the entire web directory, you must edit the domain from the ‘Manage Domains’ page.
- Only the username used to remap the subdirectory has access to that directory, and not the original owner. This means that while multiple users could each have folders assigned to them, they cannot share access to the same folder. This is illustrated in the following image:
- It’s not possible to remap directories across different servers.
CGI scripts won't work in subdirectories remapped to other user's home directories because of file ownership issues.
PHP scripts won't work in subdirectories remapped to other user's home directories because of PHP security limitations. Trying to run a script across users just loads a blank page with "No input file specified".
|Note:||PHP scripts in remapped subdirectories (within your own home directory) can only run with the server's default PHP version.|
How to remap a subdirectory
Confirming the two web directories to remap
In the following example, the remapexample.dreamhosters.com/pictures subdirectory will be remapped to a different domain and directory named dhwiki.dreamhosters.com/newpics.
Finding the web directory of the primary domain
To find the web directory:
- Navigate to the (Panel > ‘Domains’ > ‘Manage Domains’) page.
- Click the Edit button to the right of your domain.
- Under the ‘Users, Files, and Paths’ section, find the ‘Web directory:’ field. Use this directory path to your website.
- This domain is remapexample.dreamhosters.com and the user associated with the domain is dh_user
- The ‘Web directory’ is /home/dh_user/remapexample.dreamhosters.com meaning that Internet traffic would go to that directory when attempting to reach the main site.
- If someone navigates to remapexample.dreamhosters.com/pictures, then according to the web directory set up already they would be directed to /home/dh_user/remapexample.dreamhosters.com/pictures for content.
By remapping subdirectories, visitors would not need to use that folder as the source for pictures. A user could give someone else access to their /pictures folder to update it without giving full FTP access
Finding the web directory of the domain to remap
Use the same directions above to find the web directory for the domain you’re going to use to remap.
- dhwikiuser is the user for the domain.
- This means that the full path to the /newpics folder would be /home/dhwikiuser/dhwiki.dreamhosters.com/newpics.
Remapping the subdirectory
Once you know the web directories for both domains, you can proceed with remapping the subdirectories.
- Navigate to (Panel > ‘Domains’ > ‘Remap-Sub-Dir’).
- Choose your domain from the dropdown list.
- In the field to the right, type in the directory you wish to remap.
- Click the Continue… button.
- Make the following selections:
- URL to remap: This is automatically filled in by what was entered in the previous step
- New path on [servername]: Choose your second username from the dropdown. Then type in the full path to the second domain to remap.
- Click the Remap this sub-directory! button to save. This may take up to 15 minutes to update on the server.
Viewing the final result
When logging in to the original directory via FTP, you see the following files:
Note the two files:
When logging in to the second remapped domain’s directory via FTP, you see the following files:
Note the two files:
However, if you now visit the original domain of remapexample.dreamhosters.com/pictures through a web browser, only the files for the second remapped directory show:
If this subdirectory was not remapped, the Desert.jpg and Chrysanthemum.jpg photos would be showing instead.
This means that although the original user still has access to the file structure, changes made in it no longer show online since this subdirectory no longer belongs to the original user. The second user for the remapped subdirectory controls this subfolder.