Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To move an Apache site, copy its files to the new filesystem path, change DocumentRoot in every virtual host that serves the site, grant Apache safe read and traverse access, run a configuration test, then reload Apache and verify the real HTTP and HTTPS hosts. Keep the original directory until the new path has worked in production and you have a rollback plan.

What Apache’s web root actually controls

DocumentRoot is the filesystem directory that forms a site’s document tree. For a request such as /images/logo.svg, Apache normally appends that URL path to the configured root and looks for the corresponding file below it. The Apache documentation describes the directive this way: “The DocumentRoot directive specifies where in your filesystem you should place these files.”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The setting can be global, but a value inside a <VirtualHost> block applies to that host and overrides the assumption made by a global setting. A server with several domains can therefore have several active roots. Changing one file is not enough if another enabled virtual host, an HTTPS configuration, or a duplicate site definition still points to the old directory.

Plan the move before changing Apache

Identify the installation and active virtual hosts

First determine which Apache installation is running, which configuration tree it reads, and which virtual hosts are enabled. On Ubuntu, enabled site files are commonly linked from /etc/apache2/sites-enabled/ to files in /etc/apache2/sites-available/. The default site is commonly /etc/apache2/sites-available/000-default.conf, with /var/www/html as its documented default root. Other distributions and installation methods use different paths and service names.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Search the active configuration rather than editing the first occurrence you find. For example, on a Debian- or Ubuntu-style installation:

sudo grep -RIn --include='*.conf' '^[[:space:]]*DocumentRoot' /etc/apache2

Review the output together with the enabled-site links. Also inspect Apache’s virtual-host map:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apachectl -S

The output helps reveal which file answers for each hostname and whether an old or duplicate virtual host is still enabled. Do not assume that a global DocumentRoot controls a request that is matched by a host-specific block.

List dependencies on the old path

Search application and operating-system configuration for the old directory before moving it. PHP-FPM pools, CGI wrappers, upload settings, cron jobs, deployment scripts, container bind mounts, backup jobs, and network-mount definitions can all contain absolute paths. A successful Apache reload does not update those dependencies.

Prepare and copy the destination

Create an absolute directory on the new filesystem

Choose a stable absolute path, such as /srv/www/example, on a filesystem that is mounted before Apache starts. Avoid a user’s temporary or home directory unless you have deliberately configured its permissions and security policy. Confirm that the mount is present after a reboot; otherwise Apache may start against an empty directory or fail to start.

sudo mkdir -p /srv/www/example

Copy the complete site tree

Copy application files, static assets, hidden files such as .htaccess, symbolic links that are intentionally part of the application, and any required ownership, modes, ACLs, or extended attributes. Keep the old tree unchanged while you test the new one.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On systems where the required tools and attributes are available, an archive-mode copy can preserve much of this metadata:

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
sudo rsync -aHAX --info=progress2 /var/www/html/ /srv/www/example/

The exact flags supported by your operating system vary. If ACLs, security labels, or other extended attributes are part of your policy, verify them separately after copying rather than assuming a basic file copy retained them. Make sure the trailing slash semantics match your intention: the command above copies the contents of the old root into the destination, not an extra nested html directory.

Check the result before changing configuration

  • Confirm that the expected index file, application directories, hidden files, and upload directories exist below the new path.
  • Compare ownership and permissions with the original tree.
  • Check that the destination is on the intended mounted filesystem and has sufficient free space.
  • Keep the original directory available for rollback; do not delete or rename it yet.

Set permissions without creating a security hole

Apache normally starts with elevated privileges and then serves requests as its configured runtime User. That account must be able to traverse every parent directory leading to the root and read the files it serves. “Traverse” means the account needs execute permission on each directory in the path; read permission on a directory is a separate requirement for listing or looking up entries.

Give the runtime account only the access the application needs. A common arrangement is a root-owned document tree with files readable by Apache and a narrowly scoped writable directory for uploads or cache data. Do not make the entire tree world-writable, and do not let Apache’s runtime account write to configuration directories, the parent directory that contains multiple sites, or deployment metadata.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check each path component if you receive a permission error:

namei -l /srv/www/example/index.html

On systems using SELinux or AppArmor, filesystem ownership and Unix mode bits may be correct while the mandatory-access policy still denies reads. Apply the labels or profile changes required by your distribution’s security policy, and inspect the audit or error logs when denials occur. A network mount can introduce additional identity, availability, and labeling requirements.

Change the active virtual host

Use the new path in each applicable block

Edit the file that is actually enabled for the hostname. A minimal HTTP virtual host looks like this:

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot "/srv/www/example"

    <Directory "/srv/www/example">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

The <Directory> section controls filesystem access independently of the URL-to-filesystem mapping. Use only the directives your application requires. The example’s Require all granted allows requests to the directory, while AllowOverride All permits any supported setting in .htaccess; if your application does not need overrides, a narrower AllowOverride None is safer. Do not copy a permissive example without reviewing its effect.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Update HTTPS and alternate host definitions

If the site has TLS enabled, find its <VirtualHost *:443> (or equivalent) and change its DocumentRoot and matching <Directory> policy as well. Also inspect aliases, redirect-only hosts, staging names, IPv6 listeners, and any separate configuration generated by a deployment system. A browser test over HTTPS can otherwise continue to show the old tree even though port 80 serves the new one.

Do not confuse a root move with an alias

For a complete relocation, changing DocumentRoot preserves the existing URL structure and is usually the clearest approach. An Alias is appropriate when only a URL prefix should map outside the root, for example when /downloads is stored on a separate filesystem. It does not replace the site’s root unless you deliberately redesign the URL mapping.

Enable the intended site and disable stale duplicates

On Ubuntu, a2ensite creates the enabled-site link and a2dissite removes it. Use the filename that contains the edited virtual host:

sudo a2ensite example.conf
sudo a2dissite old-example.conf

These commands do not decide which virtual host should answer a request when multiple definitions have the same name. Re-run apachectl -S and confirm that the expected file is enabled, the hostname appears once in the intended place, and an old duplicate is not taking precedence. Distribution layouts that do not provide these helpers require the equivalent enablement mechanism for that installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test the configuration before applying it

Run a syntax check as the account that can read all Apache configuration files:

sudo apachectl configtest

sudo apachectl -t is an equivalent form on many installations, and Ubuntu systems may also provide sudo apache2ctl configtest. A successful check should print Syntax Ok. Fix every reported path, quoting, module, or duplicate-host problem before reloading. Apache’s control utility checks configuration before initiating a restart so a bad edit does not immediately replace a running configuration.

A syntax check does not prove that the destination exists, that Apache can traverse it, or that the application works. Test those conditions separately:

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
test -d /srv/www/example && echo 'destination exists'
test -r /srv/www/example/index.html && echo 'index is readable'

Remove the accidental closing tag if your shell reports a syntax error in the illustrative check above; the intended second command is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
test -r /srv/www/example/index.html && echo 'index is readable'

Reload Apache and verify real requests

Apply the change gracefully

Use the service command appropriate to the installation. On a systemd Ubuntu server, a configuration reload is commonly:

sudo systemctl reload apache2

sudo apachectl graceful is another common graceful method. A distribution using the httpd service may require its corresponding service command instead. If the reload fails, read the service-manager output and Apache’s error log; do not remove the old tree while the result is uncertain.

Test by hostname, not only by IP address

Request the site using its real hostname so Apache selects the same virtual host that browsers and clients use. Check both schemes when both are configured:

curl -I http://example.com/
curl -I https://example.com/

Then load a representative page and verify static assets, application routes, forms, uploads, authentication, and any rewrite rules. A successful response for the index page does not prove that every route or asset is served from the new location.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect access and error logs

Look for requests arriving at the expected virtual host, status codes such as 403 or 404, permission denials, rewrite failures, PHP-FPM connection errors, and attempts to open files under the old path. Log locations differ by distribution and virtual-host configuration; use the paths declared by the active configuration rather than assuming a single global file.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Fix a 403 Forbidden after the move

A 403 usually means Apache found the request but is not permitted to serve it. Work through these causes in order, checking the error log after each change.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

1. A parent directory is not traversable

Every directory from the filesystem root to the file needs execute permission for the Apache account, or an ACL that grants equivalent access. Use namei -l to identify the first restrictive component. Grant the narrowest required permission; do not solve a traversal problem by making every directory world-writable.

2. The directory policy denies the request

In Apache 2.4, the relevant <Directory> section normally needs an authorization rule such as Require all granted for a public site. Ensure the section names the new absolute path exactly. A policy that still names /var/www/html does not automatically apply to /srv/www/example.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. The request is reaching another virtual host

If the browser uses a hostname or HTTPS listener whose configuration still points to the old path, you may be debugging the wrong file. Check apachectl -S, the enabled-site links, and the access log for the request.

4. A required .htaccess file was omitted

Hidden files are easy to miss in a graphical copy or a shell glob. Confirm that the new tree contains the application’s .htaccess. If the application depends on it, the virtual host’s AllowOverride policy must permit the directives it uses; otherwise move those rules into the virtual-host configuration instead.

5. Symlink or security-policy rules block access

If the new tree contains symlinks, Apache’s Options policy may prohibit following them or may require a specific ownership relationship. SELinux, AppArmor, ACLs, and network-mount policies can also deny access after ordinary Unix permissions appear correct. Use the relevant audit and error logs to distinguish these cases.

Choosing between relocation methods

Method Best use Advantages Risks and checks
Change DocumentRoot The whole site moved Preserves URL paths and expresses the intended layout directly Every applicable virtual host, including HTTPS, must be updated
Alias Only a selected URL prefix belongs elsewhere Leaves the main root unchanged while mapping a subtree to another directory Requires its own directory authorization and can complicate routing
Filesystem symlink A compatibility bridge when policy deliberately permits it Can keep an old path working while files live elsewhere Symlink-following options, ownership, security labels, and backup behavior must be verified
Temporary rollback Uncertain deployment or high-risk change Switching the directive back is quick if validation fails Leaving two copies can cause edits or uploads to land in the wrong tree

For a permanent whole-site move, a direct DocumentRoot change is clearer than rewriting every URL or hiding the relocation behind a symlink.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Application and platform details that may need separate updates

PHP-FPM, CGI, and application workers

Apache may serve static files from the new root while an application worker still has the old working directory, upload path, or script restriction. Review PHP-FPM pool settings, CGI configuration, environment files, and framework-specific absolute paths. Confirm that the worker can read the new scripts and write only to its intended runtime directories.

Uploads, caches, and generated files

Moving read-only pages is simpler than moving a site that accepts uploads or generates caches. Identify every writable directory, preserve its ownership and modes, and test an actual upload or generated asset. Do not grant write access to the entire document tree merely because one subdirectory needs it.

Deployments, backups, and scheduled jobs

Update release scripts, backup definitions, monitoring checks, cron jobs, log-rotation rules, and container or orchestration bind mounts that reference the old path. A deployment that still publishes to /var/www/html can silently undo the successful move on its next run.

Retire the old root only after validation

Leave the original directory in place while you exercise normal traffic, both virtual hosts, application routes, static assets, uploads, and scheduled deployments. Confirm that backups include the new filesystem and that your rollback procedure is documented. Once traffic is demonstrably coming from the new location, archive or remove the old tree according to the site’s retention and rollback policy. Deleting it immediately removes your simplest recovery option and can expose an unnoticed dependency.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Practical completion checklist

  • All active virtual hosts and their DocumentRoot directives were inventoried.
  • The destination exists on the intended mounted filesystem.
  • Files, hidden files, ownership, modes, ACLs, and required security attributes were copied and checked.
  • Apache can traverse every parent directory and read the served content.
  • Each HTTP and HTTPS virtual host points to the new absolute path.
  • Stale duplicate sites are disabled or intentionally retained for rollback.
  • apachectl configtest or apachectl -t returns Syntax Ok.
  • The service was reloaded gracefully and requests were tested by their real hostnames.
  • Access and error logs show the expected files and no unresolved denials.
  • PHP-FPM or CGI, uploads, cron, backups, deployments, containers, and security policies no longer depend on the old path.
  • The old tree remains available until the new location is proven and a rollback decision is no longer needed.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.