Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › Cloudflare

How to Point a Domain to a Subfolder of Your Website

By Freedom251 Team · · 13 min read

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.

DNS cannot point a hostname to a folder or URL path. To make newdomain.example show an existing subfolder while keeping that hostname in the browser, point the domain’s A, AAAA, or CNAME record to the server that receives the request, then assign the domain’s document root to that subfolder. If visitors should end up at a full address such as https://example.com/subfolder, configure an HTTP redirect instead; the browser URL will change.

What “point a domain to a subfolder” actually means

A domain name and a website path are handled by different layers. The Domain Name System (DNS) answers “which server should receive requests for this hostname?” It does not understand slashes, folders, files, query strings, or URL paths. A web server or application answers the next question: “which content should this request receive?”

As an Amazon Associate I earn from qualifying purchases.

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

For example, suppose an existing site serves a project from a directory conceptually equivalent to /public/projects/blue. You have two fundamentally different ways to use another domain:

  • Mount the subfolder at the new hostname: the server uses that directory as the new domain’s document root. A visitor stays at https://newdomain.example/, while the files come from the project directory.
  • Redirect the new hostname to a path: the server sends the browser to https://example.com/projects/blue. The address bar changes to the destination URL.

A reverse proxy or application router is a third option when the content is on another service or needs host-based routing. In that arrangement DNS still points only to the front server; the proxy decides which upstream application handles the request.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Choose the right implementation

Approach What the visitor sees Where the content lives Best when Main work
Document-root mapping The new domain remains in the address bar. An existing folder on the same hosting account or server. The application works correctly when served from a different hostname. Add the domain to the host and set its document root to the folder.
HTTP redirect The browser changes to the complete target URL. Any URL that can receive the redirect. The new domain is an alias, campaign address, or permanent move. Configure forwarding and choose a permanent or temporary status.
Reverse proxy or application routing Usually the new domain remains visible. A separate upstream service, container, or application route. The target is not a local folder or needs custom host-based behavior. Configure the proxy, upstream, Host handling, and HTTPS.

Use document-root mapping when the requirement is “serve these files from this other hostname.” Use a redirect when the requirement is “send people to this exact URL.” Do not expect a DNS-only setting to perform either path selection.

Before changing anything

Confirm ownership and hosting control

You need access to the DNS zone for the domain and to the hosting account or web-server configuration that will receive it. A DNS record by itself does not create a virtual host, document root, certificate, or application route. Add the domain to the hosting account first, or create an equivalent virtual-host entry on a server you administer.

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.

Identify the existing folder

Write down the folder’s full server-side location and check that it contains the application’s entry file, such as its configured index document. Verify that the account running the web server can read the directory and its files. If the folder is generated by a framework, note its required public directory and rewrite configuration rather than pointing the domain at a private source directory.

Decide which hostname is canonical

Choose whether visitors should use the apex name (for example, newdomain.example) or the www name. If both should work, configure one as canonical and redirect the other consistently. Plan the same choice for HTTPS, cookies, canonical tags, sitemap URLs, and internal absolute links.

Plan TLS and other DNS records

List the records already used for mail and verification. A web change should not accidentally remove MX, TXT, DKIM, or other records. Decide whether a proxy will terminate HTTPS or whether the origin server will do it directly. The entered hostname must be covered by a certificate in whichever layer terminates TLS.

Set up document-root mapping (URL preserved)

This is the usual solution when a new domain should display an existing subfolder without exposing the original site’s path.

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

1. Add the domain to the hosting account

Open your host’s domain-management screen. Depending on the product, the control may be called Add-on Domain, Domain Alias, Additional Domain, or a similar label. Enter the complete domain and, when offered, disable automatic creation of a new empty directory so you can specify the existing folder.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

2. Set the document root to the existing folder

In the domain’s Document Root field, select the subfolder that should serve the site. A document root is the directory from which the web server returns publicly available files for that domain. Do not enter a browser URL such as /subfolder unless your host explicitly asks for a URL path; this setting normally expects a server filesystem location.

Save the domain and confirm that the resulting virtual-host configuration associates the new hostname with that directory. If the panel creates a second folder automatically, edit the domain again and correct the root rather than moving files blindly.

3. Point DNS at the receiving server

Create the record type supplied by your host:

Record Use it when Value
A The origin has an IPv4 address. The IPv4 address supplied by the hosting provider or server administrator.
AAAA The origin has an IPv6 address. The IPv6 address supplied by the provider or administrator.
CNAME The provider gives you a hostname instead of an address, commonly for a subdomain. The exact target hostname supplied by the provider.

Use the correct DNS name for the record. The apex domain and www are separate hostnames and may require separate records or a provider’s apex-alias feature. Leave unrelated mail and verification records intact.

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

4. Install or enable HTTPS

If visitors will use HTTPS, obtain a certificate covering the hostname and make sure the web server presents it for that virtual host. When traffic is proxied, the proxy may present the public certificate, but the origin still needs the level of encryption and certificate validation required by the selected mode. If traffic goes directly to the origin, the origin is responsible for TLS.

5. Make the application hostname-aware

Changing the document root does not automatically reconfigure an application. Check all of the following in the project’s settings:

  • Base URL, site URL, or trusted-host settings.
  • Absolute links that still point to the old hostname or expose the old subfolder.
  • Relative links and asset paths, especially links beginning with a root slash.
  • Cookie domain, secure flag, and path values.
  • Canonical link elements, Open Graph URLs, sitemap entries, and robots directives.
  • Rewrite rules that assume the application is mounted below a particular path.
  • Framework base-path or public-path settings used to build JavaScript and CSS URLs.

Keep the application’s existing rewrite rules if they are needed for front-controller routing, but test that they do not redirect every request back to the old hostname.

6. Test the mapped domain

Open the new hostname over HTTP and HTTPS, then test a representative internal page, a missing page, a form, a login, static assets, and any upload or API endpoint. Inspect the final URL and the browser’s network panel. A successful home page with broken CSS or a login loop usually indicates an incorrect base path, cookie scope, or rewrite rule rather than a DNS problem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Forward the domain with an HTTP redirect (URL changes)

Choose forwarding when the destination should be a complete URL, such as https://example.com/subfolder. The forwarding service returns an HTTP response telling the browser to request that destination. The original domain therefore will not remain in the address bar.

1. Enter the complete destination

In the registrar, hosting panel, or proxy’s forwarding interface, enter the source domain and the full target URL, including https:// and the path. A source-domain-only target is not enough when the content is in a subfolder.

2. Choose the redirect status deliberately

  • Permanent redirect: use it only when the move is intended to be durable. Search engines and browsers may cache this choice, making a later reversal harder.
  • Temporary redirect: use the provider’s temporary option while testing, during a campaign, or when the destination may change.

Do not label a temporary campaign as permanent merely because it is convenient. Test the temporary behavior first, then change it after the destination is final.

3. Make DNS reach the forwarder

The source domain must resolve to the forwarding service. Some hosting panels require its A record to point to a forwarder IP; other providers supply a CNAME or manage the record automatically. Follow the values supplied by that provider and verify that the forwarding service, not an unrelated web server, answers the request.

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

4. Handle both apex and www

If people may type either hostname, create forwarding behavior for both or redirect one to the chosen canonical hostname before sending it to the final path. Test HTTP and HTTPS variants separately. A certificate or forwarding rule for only one hostname can produce a warning or a loop on the other.

Use Cloudflare for DNS and path-based redirects

Cloudflare separates DNS resolution, proxying, TLS, and redirect processing. A redirect rule can run only after the request reaches the proxied service, so create a DNS record for the hostname and deliberately select its proxy status before expecting a redirect rule to execute.

For a URL-preserving setup

  1. Add the domain to the hosting origin or application first and assign its document root there.
  2. In the DNS records view, create the A, AAAA, or CNAME record that points to the origin or provider hostname.
  3. Choose whether the record should be proxied. Confirm that the selected TLS mode matches the certificate and encryption available at the origin.
  4. Request or install a certificate for the public hostname wherever TLS terminates.
  5. Test the hostname and inspect the origin logs to confirm that requests arrive with the expected Host value.

For a redirect to a subfolder URL

  1. Create the DNS record and enable proxying for the hostname that should issue the redirect.
  2. Open the current dashboard’s redirect-rule area and create a rule matching the source hostname.
  3. Set the destination to the complete URL, including the target path.
  4. Select a temporary status for testing; switch to a permanent status only after the destination is final.
  5. Test both hostname variants, HTTPS, query strings, and a path that does not exist on the source.

When the record is not proxied, DNS can still direct traffic to the origin, but the proxy’s redirect and TLS processing will not occur there. If the origin is serving the redirect directly, configure that behavior in the origin’s web server or hosting panel instead.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Configure a reverse proxy or application route

Use this method when the “subfolder” is really an application route or a separate upstream service. DNS points the hostname to the front server. The proxy then matches the hostname and forwards the request to the appropriate upstream, which may serve content from a local path, container, or different machine.

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

The proxy configuration must preserve the intended host and scheme information. Applications commonly use the Host value to build links and enforce allowed-host checks, while HTTPS-aware applications need a trustworthy indication that the original request was secure. Configure these headers according to the proxy and application’s documented behavior; do not accept arbitrary client-supplied forwarding headers.

Terminate TLS at the proxy only if it is configured to serve the public certificate and to use an appropriate encrypted connection to the origin when required. Otherwise, install the certificate and HTTPS virtual host on the origin. Route only the desired hostname, and add an explicit fallback so an unknown hostname cannot reach an unintended application.

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

DNS and HTTPS details that commonly cause failures

DNS points to the wrong layer

An A or AAAA record aimed at the old server will never reach the new document root. A CNAME aimed at a provider hostname can also be wrong if the provider expects a different target. Check the active DNS zone, not just a saved draft in a hosting panel.

The domain was never added to the server

Even with a correct record, the server may return a default site, an “unknown host” page, or a certificate for another domain if no virtual-host entry exists. Add the domain in the hosting account or web-server configuration and verify its document root.

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

Only one address family works

An AAAA record can send IPv6 visitors to a different server than IPv4 visitors. If IPv6 is not configured for this site, remove the stale AAAA record or configure the IPv6 origin correctly. Test from networks that use each protocol.

TLS is terminated somewhere unexpected

A proxy may show a valid public certificate while the origin is misconfigured, or a direct connection may reach an origin certificate that does not include the new hostname. Identify the TLS termination point and install the matching certificate there. Cloudflare’s documentation distinguishes DNS reachability from SSL/TLS security: DNS says where a service can be reached, while TLS establishes a secure connection.

Redirect loops appear

Loops often result from combining an HTTPS-enforcing proxy with an origin that does not recognize the original request as HTTPS, or from redirecting the canonical hostname back to itself. Check the proxy’s encryption mode, forwarded scheme handling, and every rewrite rule. Temporarily disable one redirect layer at a time to find the source.

Application and SEO checks after mapping

Serving the same files under a second hostname can create duplicate or inconsistent URLs unless the application is configured intentionally. Decide whether the new domain is an independent site, an alias, or a temporary access address.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Set canonical tags and sitemap URLs to the hostname you want indexed.
  • Update absolute links in templates, feeds, structured data, email templates, and JavaScript configuration.
  • Check that redirects do not send crawlers or users through multiple hostname and path hops.
  • Review login, checkout, and administrative cookies for the correct domain and path scope.
  • Confirm that robots rules and security policies allow the intended hostname.
  • If the old path should disappear, redirect its URLs individually or with a carefully tested rule rather than redirecting every request to the home page.

If the new hostname is only an alias, a permanent redirect to the preferred URL is usually clearer than serving identical content from both names. If it is meant to be a separate public site, give it its own canonical URLs and application configuration instead of inheriting the old site’s identity accidentally.

Keep email and verification records working

Web hosting and email can use different providers. Changing the web A, AAAA, or CNAME record does not require moving MX records, but deleting or replacing the entire DNS zone can break mail delivery and domain verification. Preserve MX, TXT, DKIM, SPF, DMARC, and service-verification records unless you intentionally manage them elsewhere.

Some providers do not allow a CNAME at the apex, while others offer an alias mechanism. Follow the provider’s record requirements rather than substituting a record type that happens to look similar. Keep a copy of the current zone before editing it.

Testing checklist

  1. Confirm the domain is present in the hosting account or virtual-host configuration.
  2. Verify the A, AAAA, or CNAME record and ensure it targets the intended receiving layer.
  3. Open the apex and www names over HTTP and HTTPS.
  4. Check the certificate name, final URL, and redirect status in the browser or an HTTP inspection tool.
  5. Load the home page and at least one nested page from the mapped folder.
  6. Inspect CSS, JavaScript, images, fonts, forms, logins, uploads, and API calls.
  7. Review server or proxy logs for the expected hostname and absence of default-site responses.
  8. Confirm canonical tags, sitemap URLs, cookies, and absolute links use the intended hostname.
  9. Send a test message if the domain is used in email links, while leaving mail DNS records unchanged.

Troubleshooting by symptom

Symptom Likely layer What to check
“DNS error” or no connection DNS Record name, record type, target value, and whether the active DNS provider is the one you edited.
Default hosting page Hosting configuration Domain added to the account and virtual host; document root points to the intended folder.
Correct page but broken assets Application paths Base URL, root-relative links, framework public path, and rewrite rules.
Certificate warning TLS Certificate coverage for the entered hostname and the layer terminating HTTPS.
Unexpected URL change Redirect or canonical rules Forwarding settings, application base URL, canonical-host redirect, and proxy rules.
Login loop or missing session Cookies or HTTPS awareness Cookie domain/path, secure settings, trusted host, and forwarded scheme handling.
Only IPv4 or IPv6 works Address records Whether A and AAAA point to compatible origins and virtual hosts.
Redirect rule never runs Proxy status Whether the hostname resolves through the proxy that owns the redirect rule.

Common mistakes to avoid

  • Putting /subfolder into a DNS record. DNS values are addresses or hostnames, not paths.
  • Creating a DNS record but not adding the domain to the hosting account.
  • Mapping the domain to the project’s private source directory instead of its public web directory.
  • Using a permanent redirect while the destination is still being tested.
  • Issuing redirects at both the proxy and origin without documenting which layer is authoritative.
  • Changing nameservers or replacing the whole DNS zone when only a web record needed updating.
  • Testing only the home page and overlooking forms, cookies, assets, APIs, and nested routes.
  • Allowing both apex and www versions to serve independently without a canonical policy.

Which method should you use?

Choose document-root mapping when the new hostname should remain visible and the application can operate under that hostname. Choose an HTTP redirect when the destination URL is authoritative, the new domain is a forwarding address, or the application should not be duplicated under another host. Choose a reverse proxy or application route when the content is supplied by another service or requires host-based routing that a control-panel document root cannot express.

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

In every case, the sequence is the same at a high level: make DNS reach the correct server or proxy, configure that layer to select the content or destination, secure the hostname with HTTPS, and then test application-generated URLs and stateful features. The visible-URL requirement determines whether you map a document root or issue a redirect.

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.

CloudflarecPanelDNSdomainsHTTPSreverse proxyWeb hosting

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.