What is a reverse proxy?
A proxy is a server that your web requests go through. A reverse proxy takes external requests, acting on behalf of your web server and defines how they should be processed. A forward proxy on the other hand, acts on behalf of clients and determines how internal requests should be processed.
A reverse proxy can present information from a separate server as if it was coming from the main server. To put it simply, you could have a blog or shop separate from your main site, on a subdomain. For example:
But you may want the subdomain to instead exist as a folder on the main site. When the reverse proxy is setup it changes to
By using subfolders instead of subdomains you can bring your content together under one domain. Multiple databases, platforms and CMSs can be used and appear under the one domain.
Why you should use a reverse proxy
There are many reasons why you may want to use a reverse proxy, these include:
- Content delivery
- To block inbound requests
- Re rerouting requests
- Selectively caching and serving websites
- Reporting on the status of the requests
- Serving alternative content by rulesets
While the reasons for using a reverse proxy go far beyond simple content delivery, such as making an internal web server accessible to other users, it’s important to note a reverse proxy’s impact on SEO.
Why you should use a reverse proxy for SEO
Hosting a blog, online store or other website on a subdomain can create numerous SEO issues. Essentially when it comes to SEO and marketing efforts, if you have a subdomain rather than a subfolder, your workload is doubled. Hosting on a separate server creates a weak link between your main site and subdomain. The SEO authority that passes from a subdomain to the main site is much less than the SEO authority passed from a subfolder. The content on the subdomain is also less visible than if it were in a subfolder.
While Google’s Matt Cutts has stated that subdomains and subfolders are “roughly equivalent” when it comes to SEO, that’s not exactly the case. Regardless of what we read and what Google wants us to think, there is definitely an SEO boost when using a reverse proxy for a subfolder rather than a subdomain.
If you’re starting from scratch then you’ll want to avoid double the workload by housing your blog or other potential subdomains on the main site before you start working on your SEO. On the other hand if your main site already has a lot of value then your secondary site can benefit from this and vice versa.
Why do so many website have subdomains?
While using a subfolder over a subdomain is so important for passing SEO value, you may be asking, why then do so many websites have subdomains? To put it simply, it’s easier. Having said that, we must clarify that subdomains are in fact easier to set up but they are not easier over the long run.
Subdomains are the easiest way to get started. This is especially true if you use a third-party hosted system, such as using a WordPress.com blog. It’s quick and easy to set up. Simply host the blogging tool on a subdomain and you can start posting content right away.
However, if you’re starting a blog or other subdomain in order to pass over SEO value to your main site, then instead you’ll want to set up a reverse proxy in order to have it as a subfolder.
You may find disagreement on the subdomain vs. subfolder issue between your tech team and marketing team. This is because subdomains are much simpler and easier for your tech team, however this will mean your marketing team has to double down on their efforts.
How a reverse proxy works
Step 1: To setup a reverse proxy you’ll need to access your .htaccess file on your main website. Essentially you’re asking your main domain to return a request for /subfolder/ from the subdomain.
Step 2: Once you have the same content on /subfolder/ as you do on your subdomain you need to make sure there’s no chance of getting penalised for duplicate content. To do this you’ll need to ensure that no subdomain pages are being indexed.
Step 3: Then you’ll also need to transfer over your link juice that’s pointing to the original URLs. To do this you’ll need to implement a canonical tag that points to the /subfolder/ URL for each of the subdomain URLs.
Step 4: To ensure search engines aren’t crawling the old URLs, you’ll also have to add a disallow directive in the robots.txt file hosted on the subdomain.
Unless your main website is substantially different from your subdomain (meaning no SEO value would be gained from your subdomain and vice versa) then use a reverse proxy in order to obtain greater SEO value from both your main site and secondary site. This will greatly improve your online marketing efforts.