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.
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:
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.
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.
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.
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).
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.
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.
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.
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.
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:
rel="canonical"
properly.It’s best to check with Google Search Console after setting up masking to ensure that content is being indexed as expected.
Sometimes masking isn’t the best option. And again, it’s very difficult.
Depending on your goals, consider these alternatives:
example.com/store
.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.
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.
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:
blog.example.com
./blog
—in your Headless Hostman dashboard.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.
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.
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.
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?