How to Mask a Subdomain URL in WordPress (Complete Guide)

How to mask a subdomain URL in WordPress without compromising SEO or performance.

If you’re running a WordPress site and using a subdomain—for example, shop.example.com or blog.example.com—you might want the content to appear under a different URL.

Maybe you want it to show as example.com/shop instead. That’s where URL masking comes in. In this post, we’ll explore how to mask a subdomain URL in WordPress without compromising SEO or performance.

What Is URL Masking and Why Would You Do It?

URL masking is the practice of showing a different URL in the browser while the actual content is served from another location. This can be useful if:

  • You want cleaner or branded URLs.
  • You’re hosting a site on a subdomain but want it to look like a subdirectory.
  • You’re running a campaign or microsite and don’t want to expose the underlying structure.

It’s worth noting: masking is not the same as a redirect. With masking, the original URL stays visible in the address bar, even though the content is coming from elsewhere.

How Difficult is It?

In fact, very difficult. We’ll provide some suggestions, but this is generally not advisable and is hard to pull off. You need the perfect combination of the right host (who supports it) and perfect execution.

You should consider just migrating your site to the correct URL instead of this. Do so at your own risk.

Common Use Cases for Subdomain Masking

Let’s say you’re using a platform like WooCommerce on store.example.com but want users to see example.com/store instead. Or maybe your WordPress blog is on blog.example.com, but for branding consistency, you want it to appear under example.com/blog.

Masking helps in both these cases, especially when you can’t move content physically due to hosting or technical constraints.

1. Using an iframe to Mask a Subdomain

This is the simplest method, but it comes with trade-offs. An iframe embeds one webpage inside another. You can place this iframe on a main domain page and load your subdomain content inside it:

<!DOCTYPE html>
<html>
<head>
  <title>Our Shop</title>
</head>
<body>
  <iframe src="https://shop.example.com" width="100%" height="1000px" frameborder="0">
    Your browser doesn't support iframes.
  </iframe>
</body>
</html>

Pros: Easy to set up, works instantly.
Cons: Poor for SEO, can break functionality (especially if the embedded site uses cookies, sessions, or cross-domain JavaScript).

2. Using .htaccess and mod_rewrite

If you’re on an Apache server and have access to .htaccess files, you can create a rewrite rule that fetches the subdomain content from a directory-style URL:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^store/(.*)$ http://store.example.com/$1 [P,L]

This proxy pass tells the server to fetch content from store.example.com when someone visits example.com/store.

Important: Your server must have mod_proxy enabled for this to work. Also, proxying content this way can introduce security concerns if not properly configured.

Please note: This does NOT work with every WordPress hosting platform available. Check with them before you attempt this, lest you get a broken website in the process.

3. Use a Reverse Proxy (Nginx or Apache)

Reverse proxies allow you to serve content from another server or subdomain while maintaining the main domain in the browser address bar.

Here’s an example of an Nginx configuration:

location /store/ {
    proxy_pass https://store.example.com/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
}

This method is far more robust and SEO-friendly compared to iframes. However, it requires access to your server’s configuration files and root-level permissions.

4. WordPress Plugins (Limited Options)

There are very few plugins that truly mask subdomains. Most handle redirects or multisite setups. However, plugins like WP Reverse Proxy (or custom-coded solutions using wp_remote_get) can be adapted for masking purposes.

If you’re running a multisite WordPress network, you might consider using domain mapping to point different domains or subdomains to specific sites within the network. This won’t mask the subdomain but can help restructure your URL strategy.

5. Cloudflare Workers or Edge Proxies

If you’re already using a CDN like Cloudflare, you can set up a Cloudflare Worker to intercept the request to example.com/store and fetch content from store.example.com. Here’s a simplified version:

addEventListener("fetch", event => {
  event.respondWith(handleRequest(event.request));
})

async function handleRequest(request) {
  const url = new URL(request.url);
  const proxiedUrl = "https://store.example.com" + url.pathname.replace("/store", "");
  return fetch(proxiedUrl, {
    headers: request.headers
  });
}

This approach is fast, secure, and scalable—perfect for modern WordPress sites using edge delivery.

SEO Considerations When Masking URLs

This is critical: masked content won’t help your SEO unless done correctly. Search engines won’t index iframe content. If you’re proxying with Nginx or Apache, make sure:

  • You’re sending the correct headers.
  • Your canonical tags reflect the masked URL.
  • You avoid duplicate content issues by using rel="canonical" properly.
  • You’re not blocking bots from crawling the subdomain.

It’s best to check with Google Search Console after setting up masking to ensure that content is being indexed as expected.

Alternatives to Subdomain Masking

Sometimes masking isn’t the best option. And again, it’s very difficult.

Depending on your goals, consider these alternatives:

  • Full migration: Move the site from the subdomain into a subdirectory structure like example.com/store.
  • Reverse proxy without masking: Allow the subdomain to serve content, but use canonical tags to unify SEO signals.
  • Multisite + domain mapping: If your site architecture is flexible, using WordPress multisite may give you the control you need.

6. How Headless Hostman Solves Subdomain Masking

If you’re trying to mask a subdomain in WordPress—like making blog.example.com appear as example.com/blog—you’ve probably hit some walls. Maybe you’ve tried iframes. Maybe you wrestled with .htaccess rewrites or played reverse proxy games on your server. It’s messy, fragile, and often kills your SEO.

That’s where Headless Hostman comes in. We don’t just host static WordPress sites—we solve problems like this with built-in subdomain masking that’s clean, fast, and SEO-friendly.

Subdomains Become Seamless Subdirectories

With Headless Hostman, you can run your WordPress site on a subdomain like blog.example.com, then publish a static version that lives at example.com/blog—completely masked and fully integrated. Visitors never see the subdomain. Crawlers treat it as native. You maintain the backend freedom of subdomain hosting, with the frontend simplicity of a flat directory.

This is made possible by our static publishing engine, which crawls your subdomain, renders every page, and rewrites paths so they live happily under any subdirectory you choose—/blog, /store, /docs, or anywhere else on your root domain.

Why This Works Better Than Traditional Masking

  • No iframes: Your content renders directly—no clunky embeds or sandbox limitations.
  • No server rewrites: No Apache or Nginx gymnastics required. We handle the routing.
  • 100% SEO safe: Google sees native pages, indexes canonical URLs, and respects your site hierarchy.
  • Performance-first: Every page is cached and deployed over our global CDN, lightning-fast.

Real-World Use Case

Let’s say your dev team runs a marketing site at www.example.com, and your blog lives at blog.example.com. Normally, merging the two means complex multisite setups or expensive server hacks. With Headless Hostman, you just:

  1. Connect your WordPress blog hosted at blog.example.com.
  2. Choose your target path—like /blog—in your Headless Hostman dashboard.
  3. We crawl, build, and deploy everything to example.com/blog, perfectly masked.

The blog still lives on its own instance. But to the world (and to Google), it’s just part of your main site.

The Headless Hostman Advantage

  • Hosted on our fast, secure, CDN-backed edge platform.
  • Built-in Git-style version control for every deployment.
  • Push multiple subdomains into one root domain structure.
  • Hardened security, no public-facing WordPress login or database.

And yes—this all happens without breaking your WordPress dashboard. You can keep writing posts, updating content, and publishing like normal. We handle the build and masking pipeline in the background.

Want to Mask Your Subdomain the Right Way?

Forget the hacks and fragile workarounds. If you’re ready to mask a WordPress subdomain and turn it into a clean, crawlable directory on your main site, Headless Hostman is built for exactly that.

One backend. One frontend. Zero compromises.

Wrapping Up

Masking a subdomain URL in WordPress can be as simple or as complex as your setup demands. If you’re just looking for a quick visual workaround, an iframe might work. But if you care about SEO, security, and performance, consider a proper reverse proxy or Cloudflare Worker solution.

Need help?

ready to get started?

Headless Hostman takes the best of both traditional CMS systems and other static host providers to create a site that is both easy to manage, fast, and secure.