undefined
Skip to content
Moz logo Menu open Menu close
  • Products
    • Moz Pro
    • Moz Pro Home
    • Moz Local
    • Moz Local Home
    • STAT
    • Moz API
    • Moz API Home
    • Compare SEO Products
    • Moz Data
  • Free SEO Tools
    • Domain Analysis
    • Keyword Explorer
    • Link Explorer
    • Competitive Research
    • MozBar
    • More Free SEO Tools
  • Learn SEO
    • Beginner's Guide to SEO
    • SEO Learning Center
    • Moz Academy
    • MozCon
    • Webinars, Whitepapers, & Guides
  • Blog
  • Why Moz
    • Digital Marketers
    • Agency Solutions
    • Enterprise Solutions
    • Small Business Solutions
    • The Moz Story
    • New Releases
  • Log in
  • Log out
  • Products
    • Moz Pro

      Your all-in-one suite of SEO essentials.

    • Moz Local

      Raise your local SEO visibility with complete local SEO management.

    • STAT

      SERP tracking and analytics for enterprise SEO experts.

    • Moz API

      Power your SEO with our index of over 44 trillion links.

    • Compare SEO Products

      See which Moz SEO solution best meets your business needs.

    • Moz Data

      Power your SEO strategy & AI models with custom data solutions.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Free SEO Tools
    • Domain Analysis

      Get top competitive SEO metrics like DA, top pages and more.

    • Keyword Explorer

      Find traffic-driving keywords with our 1.25 billion+ keyword index.

    • Link Explorer

      Explore over 40 trillion links for powerful backlink data.

    • Competitive Research

      Uncover valuable insights on your organic search competitors.

    • MozBar

      See top SEO metrics for free as you browse the web.

    • More Free SEO Tools

      Explore all the free SEO tools Moz has to offer.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Learn SEO
    • Beginner's Guide to SEO

      The #1 most popular introduction to SEO, trusted by millions.

    • SEO Learning Center

      Broaden your knowledge with SEO resources for all skill levels.

    • On-Demand Webinars

      Learn modern SEO best practices from industry experts.

    • How-To Guides

      Step-by-step guides to search success from the authority on SEO.

    • Moz Academy

      Upskill and get certified with on-demand courses & certifications.

    • MozCon

      Save on Early Bird tickets and join us in London or New York City

    Unlock flexible pricing & new endpoints
    Moz API

    Unlock flexible pricing & new endpoints

    Find your plan
  • Blog
  • Why Moz
    • Digital Marketers

      Simplify SEO tasks to save time and grow your traffic.

    • Small Business Solutions

      Uncover insights to make smarter marketing decisions in less time.

    • Agency Solutions

      Earn & keep valuable clients with unparalleled data & insights.

    • Enterprise Solutions

      Gain a competitive edge in the ever-changing world of search.

    • The Moz Story

      Moz was the first & remains the most trusted SEO company.

    • New Releases

      Get the scoop on the latest and greatest from Moz.

    Surface actionable competitive intel
    New Feature

    Surface actionable competitive intel

    Learn More
  • Log in
    • Moz Pro
    • Moz Local
    • Moz Local Dashboard
    • Moz API
    • Moz API Dashboard
    • Moz Academy
  • Avatar
    • Moz Home
    • Notifications
    • Account & Billing
    • Manage Users
    • Community Profile
    • My Q&A
    • My Videos
    • Log Out

The Moz Q&A Forum

  • Forum
  • Questions
  • Users
  • Ask the Community

Welcome to the Q&A Forum

Browse the forum for helpful insights and fresh discussions about all things SEO.

  1. Home
  2. SEO Tactics
  3. Intermediate & Advanced SEO
  4. Using a Reverse Proxy and 301 redirect to appear Sub Domain as Sub Directory - what are the SEO Risks?

Moz Q&A is closed.

After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

Using a Reverse Proxy and 301 redirect to appear Sub Domain as Sub Directory - what are the SEO Risks?

Intermediate & Advanced SEO
2
4
3.3k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as question
Log in to reply
This topic has been deleted. Only users with question management privileges can see it.
  • joshibhargav_20
    joshibhargav_20 last edited by Mar 19, 2020, 2:03 AM

    We’re in process to move WordPress blog URLs from subdomains to sub-directory. We aren’t moving blog physically, but using reverse proxy and 301 redirection to do this.

    • Blog subdomain URL is https://blog.example.com/ and
    • destination sub-directory URL is https://www.example.com/blog/

    Our main website is e-commerce marketplace which is YMYL site. This is on Windows server. Due to technical reasons, we can’t physically move our WordPress blog to the main website.

    Following is our Technical Setup

    1. Setup a reverse proxy at https://www.example.com/blog/ pointing to https://blog.example.com/
    2. Use a 301 redirection from https://blog.example.com/ to https://www.example.com/blog/ with an exception if a traffic is coming from main WWW domain then it won’t redirect. Thus, we can eliminate infinite loop.
    3. Change all absolute URLs to relative URLs on blog
    4. Change the sitemap URL from https://blog.example.com/sitemap.xml to https://www.example.com/blog/sitemap.xml and update all URLs mentioned within the sitemap.

    SEO Risk Evaluation

    We have individual GA Tracking ID and individual Google Search Console Properties for main website and blog. We will not merge them. Keep them separate as they are.

    Keeping this in mind, I am evaluating SEO Risks factors

    1. Right now when we receive traffic from main website to blog (or vice versa) then it is considered as referral traffic and new cookies are set for Google Analytics. What’s going to happen when its on the same domain?
    2. Which type of settings change should I do in Blog’s Google Search Console? (A). Do I need to request “Change of Address” in the Blog’s search console property? (B). Should I re-submit the sitemap?
    3. Do I need to re-submit the blog sitemap from the https://www.example.com/ Google Search Console Property?
    4. Main website is e-commerce marketplace which is YMYL website, and blog is all about content. So does that impact SEO?
    5. Will this dilute SEO link juice or impact on the main website ranking because following are the key SEO Metrices. (A). Main website’s Avg Session Duration is about 10 minutes and bounce rate is around 30% (B). Blog’s Avg Session Duration is 33 seconds and bounce rate is over 92%
    1 Reply Last reply Reply Quote 0
    • BlueprintMarketing
      BlueprintMarketing last edited by Mar 19, 2020, 4:50 PM Mar 19, 2020, 4:50 PM

      I wrote this on my phone and I will update this in 2-3 hours

      rewrite the URLs do not redirect

      1 Reply Last reply Reply Quote 0
      • BlueprintMarketing
        BlueprintMarketing last edited by Mar 19, 2020, 4:48 PM Mar 19, 2020, 4:34 PM

        PS

        tools like CloudFlare & Fastly don’t care what you’re server is .

        https://blog.cloudflare.com/subdomains-vs-subdirectories-best-practices-workers-part-1/

        https://blog.cloudflare.com/subdomains-vs-subdirectories-improved-seo-part-2/

        https://moz.com/community/q/reverse-proxy-a-successful-blog-from-subdomain-to-subfolder

        frontend ssl_in
        bind :443 ssl crt /etc/haproxy/website.com.combined
        acl root path /
        acl blog path_beg /blog
        acl sitedomain path_beg /leasopedia
        acl glossary path_beg /glossary
        acl wpadmin path_beg /wp-
        acl blog_search query -m reg ^s=.
        $
        acl blog_preview query -m reg ^p=.*$

        use_backend wpengine if blog OR sitedomain OR glossary OR wpadmin OR root blog_search OR root blog_preview
        default_backend main-site

        backend wpengine
        server wpengine examplecompany.wpengine.com:443 ssl ca-file /etc/ssl/certs/ca-certificates.crt

        backend main-site
        server main-site example.examplecompany.com.:443 ssl ca-file /etc/ssl/certs/ca-certificates.crt

        https://blog.examplecompany.com or https://examplecompany.com/blog.

        It’s worth noting that WPEngine does not recommend this practice. 

        For those that want to host at https://site.com/blog and do it with a managed WordPress hosting provider like WPEngine, this article is for you.

        (Note, WPEngine will automatically block your reverse proxy, so you will need to contact customer support and ask them to whitelist its IP address in their firewall. I found this to be a painless process thanks to the friendly support staff at WPEngine.)

        How?

        The trick to getting the blog to look like it’s living on the main site (but actually living elsewhere) is to use a reverse proxy.

        HAProxy is a powerful reverse proxy, though its configuration has a bit of a learning curve compared to Nginx or Apache.

        We use HAProxy internally because it works well with AWS Elastic Load Balancers, which frequently change their IP address. Learn more

        HAProxy config

        | 1 | bind *:443ssl crt/etc/haproxy/website.com.combined |

        You’ll need to use SSL, as all WPEngine installs redirect to SSL.

        Of note is that HAProxy expects your certificate chain and your private key to be combined into one file

        | 1 | acl |

        These are the pattern matching lines that we’ll use to determine which traffic is forwarded to WPEngine

        | 1 |

        use_backend wpengine ifblog orsitename ORglossary ORwpadmin ORroot blog_search ORroot blog_preview

        |

        This directs /blog*, /sitename*, /glossary* and /wp-* to WPEngine.

        You can replace these with your own blog and page paths configured in wordpress.

        This line also directs /?s= and /?p= to wordpress using the combined root and blog_search and blog_preview lines.

        These are necessary to making searching and page previews work in WordPress.

        | 1 | default_backend main-site |

        Everything that doesn’t match one of the above patterns will go to the main site.

        | 1 | backend wpengine |

        Directives in the frontend that resolve to this backed will route to the blog.

        | 1 | backend main-site |

        Directives in the frontend that resolve to this backed will route to your main site.

        I would use Fastly

        https://thoughtbot.com/blog/host-your-blog-under-blog-on-your-www-domain

        https://blog.cloudflare.com/subdomains-vs-subdirectories-best-practices-workers-part-1/

        https://link.medium.com/g1ReAhcnZ4

        1 Reply Last reply Reply Quote 0
        • BlueprintMarketing
          BlueprintMarketing last edited by Sep 8, 2020, 5:04 AM Mar 19, 2020, 4:20 PM

          Hi I have done this for 20+ websites.

          Following is our Technical Setup

          1. Setup a reverse proxy at https://www.example.com/blog/ pointing to https://blog.example.com/

          please remember that the hosting or reverse proxy on the server is so important. Some managed WordPress hosts do this better then others.

          https://pressidium.com/ now offers reverse proxy's on all plans for free

          https://pressidium.com/blog/2019/wordpress-reverse-proxy-how-universities-corporations-are-benefitting-from-reverse-proxy-setups/

          if you want to do this with out having to worry about it any problem I cannot stress how easy it is done by hosting the blog on Pagely.com it’s now free!

          (don’t worry about the $200 they don’t change it)

          https://support.pagely.com/hc/en-us/articles/213148558-Reverse-Proxy-Setup

          or kinsta for $50 more a month

          https://kinsta.com/knowledgebase/reverse-proxy/

          Pantheo.io (my go to host) now offers the “Advanced Global CDN” it lets you run a reverse proxy & much more via Fastly (my favorite CDN) the cost is very reasonable.

          https://pantheon.io/product/advanced-global-cdn

          Servebolt.com offers reverse proxy & hosts all PHP sites Wordpress too. They use CloudFlare & they will setup everything for you for free. They are also a full enterprise partner

          https://servebolt.com/help/article/cloudflare-workers-reverse-proxy/

          You  can also use Fastly, CloudFlare business, Incapsula, Cloudfront

          2.    Use a 301 redirection from https://blog.example.com/ to https://www.example.com/blog/ with an exception if a traffic is coming from main WWW domain then it won’t redirect. Thus, we can eliminate infinite loop.

          This is something that is very easy I would use Fastly

          • Change all absolute URLs to relative URLs on blog

          NO don’t do that it will hurt your site & will not help you change the URLs they need to be rewritten not made relative it’s a very bad way of trying to do this and will not help your site.

          • Change the sitemap URL from https://blog.example.com/sitemap.xml to https://www.example.com/blog/sitemap.xml and update all URLs mentioned within the sitemap

          Our main website is e-commerce marketplace which is YMYL site. This is on Windows server. Due to technical reasons, we can’t physically move our WordPress blog to the main website.

          If  you’re website site is YMYL I would use Pagely but Linode , AWS can do this to  with Fastly or  Nginx

          https://thoughtbot.com/blog/host-your-blog-under-blog-on-your-www-domain

          <code>location /blog/ {
              proxy_pass https://blog.example.com;
              proxy_set_header Host $host;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Forwarded-Proto $scheme;
          }</code> 
          

          <code>please let me know if you need help
          Tom</code>

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          1 out of 4
          • First post
            1/4
            Last post

          Got a burning SEO question?

          Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


          Start my free trial


          Browse Questions

          Explore more categories

          • Moz Tools

            Chat with the community about the Moz tools.

          • SEO Tactics

            Discuss the SEO process with fellow marketers

          • Community

            Discuss industry events, jobs, and news!

          • Digital Marketing

            Chat about tactics outside of SEO

          • Research & Trends

            Dive into research and trends in the search industry.

          • Support

            Connect on product support and feature requests.

          • See all categories

          Related Questions

          • anagentile

            Redirection of 100 domain to Main domain affects SEO?

            domain seo redirecting domain

            Hi guys, An email software vendor managed by a different area of my company redirected 100 domains used for unsolicited email campaigns to my main domain. These domains are very likely to get blacklisted at some point. My SEO tool now is showing me all those domains as "linking" to my main site as do-follow links. The vendor states that this will not affect my main domain/website in any way. I'm highly concerned. I would appreciate your professional opinion about this. Thanks!!

            Intermediate & Advanced SEO | Apr 6, 2024, 2:34 AM | anagentile
            0
          • MAdeit

            Is there any benefit to changing 303 redirects to 301?

            A year ago I moved my marketplace website from http to https. I implemented some design changes at the same time, and saw a huge drop in traffic that we have not recovered from. I've been searching for reasons for the organic traffic decline and have noticed that the redirects from http to https URLs are 303 redirects. There's little information available about 303 redirects but most articles say they don't pass link juice. Is it worth changing them to 301 redirects now? Are there risks in making such a change a year later, and is it likely to have any benefits for rankings?

            Intermediate & Advanced SEO | Jan 21, 2019, 10:42 AM | MAdeit
            0
          • imran2078

            Should I redirect my Google Update Effected Domain to brand new Domain?

            Hey Moz experts, I had a domain which was really doing better but after the Humming Bird update my traffic was decreased up to 90%. There are plenty of posts on my existing blog, Now what should I do? I mean should I redirect it to a brand new domain or Copy all the posts to a brand new domain and delete my existing domain? Note that the Old domain has PR1, DA 19 and PA 30.

            Intermediate & Advanced SEO | Mar 16, 2014, 3:18 PM | imran2078
            0
          • ajarad

            Geoip redirection, 301 or 302?

            Hello all Let me first try to explain what our company does and what it is trying to achieve. Our company has an online store, sells products for 3 different countries, and two languages for each country. Currently we have one site, which is open to all countries, what we are trying to achieve is make 3 different stores for these 3 different countries, so we can have a better control over the prices in each country. We are going to use Geoip to redirect the user to the local store in his country. The suggested new structure is to add sub-folders as following: www.example.com/ca-en
            www.example.com/ca-fr
            www.example.com/us-en
            ... If a visitor is located outside these 3 countries, then she'll be redirected to the root directory www.example.com/en We can't offer to expand our SEO team to optimize new pages for the local market, it's not the priority for now, the main objective now is to be able to control the prices for different market. so to eliminate the duplicate issue, we'll use canonical tags. Now knowing our objective from the new URL structure, I have two questions: 1- which redirect should we use? 301, 302? 
            If we choose 301, then which version of the site will get the link juice? (i.e, /ca-en or /us-en?)
            if we choose 302, then will the link juice remain in the original links? is it healthy to use 302 for long term redirections? 2- Knowing that Google bots comes from US-IP, does that mean that the other versions of the site won't be crawled (i.e, www.example.com/ca-fr), this is especially important for us as we are using AdWords, and unindexed pages will effect our quality score badly. I'd like to know if you have other account structure in your mind that would be better than this proposed structure. Your help is highly highly appreciated.
            Thanks in advance.

            Intermediate & Advanced SEO | Nov 18, 2013, 9:59 PM | ajarad
            0
          • CommercePundit

            How to stop Google crawling after 301 redirect?

            I have removed all pages from my old website and set 301 redirect to new website. But, I have verified old website with Google webmaster tools' HTML verification file which enable me to track all data and existence of pages in Google search for my old website. I was assumed that, Google will stop crawling and DE-indexed all pages after 301 redirect. Because, I have set 301 redirect before 3 months. Now, I'm able to see Google bot activity on my website with help of Google webmaster tools. You can find out attachment to know more about it. How can it possible & How Google can crawl removed pages? You can see following image to know more about it. First & Second

            Intermediate & Advanced SEO | Jul 19, 2012, 12:40 PM | CommercePundit
            0
          • peterwhitewebdesign

            New Site: Use Aged Domain Name or Buy New Domain Name?

            Hi,
            I have the opportunity to build a new website and use a domain name that is older than 5 years or buy a new domain name. The aged domain name is a .net and includes a keyword.
            The new domain would include the same keyword as well as the U.S. state abbreviation. Which one would you use and why? Thanks for your help!

            Intermediate & Advanced SEO | Mar 2, 2012, 4:47 PM | peterwhitewebdesign
            0
          • MAGNUMCreative

            Migrating online store to subdomain using shopify and effects on seo and energy down the road for seo

            I'm looking for some clarity... Looking at using Shopify for an existing online store that we have to migrate. Setting up the store with shopify means we will be using a subdomain such as shop.mywebsite.com instead of mywebsite.com/shop. The following are points to consider when responding The client currently has an online store, however it's a proprietary shopping store and CMS that has since gone defunct and they need to migrate to an alternative in order to survive online against new CMS systems that allow the site and its content to be better optimized. There is a lot of existing SEO done on the current site that we don't want to loose PR on. There is roughly 2000 products Client has a fixed budget, dealing with checkout issues, custom work and various other "bugs" seems to be easier controlled with Shopify...thus budget can be used more on content/strategy and migration We want to run the main site in Wordpress and are wanting to use Shopify since it supports a gateway, has great features and seems like it would allow us to get more bang for the buck and can focus more on the main site and content strategy and drive traffic to the subdomain store if needed Or main concern is the effort of migrating 2000+ products to shopify and the traffic and PR it gives the current site will have a negative effect on the main domain itself. Should we really be considering this path? The domain is diveidc.com One main benefit to the subdomain is the ability to clearly segment products from the service portion of the site in the analytics and focus 2 clear strategies and track it in a very defined manner. We're really on the fence with this...any thoughts are welcome.

            Intermediate & Advanced SEO | Sep 25, 2011, 3:33 PM | MAGNUMCreative
            0
          • FrontlineMobility

            How do I go about changing a 302 redirect to a 301.

            Hello Friends! Thanks for viewing my question. Ok,My question today is How do I go about redirecting a 302 link to a 301 link. I understand the benefits of doing this as far as link juice and how the Search Engines views the two Re-Directs. I am wanting to know where I would start to do this. Thank you in advance for any help or suggestions!

            Intermediate & Advanced SEO | Aug 25, 2011, 2:01 PM | FrontlineMobility
            0

          Get started with Moz Pro!

          Unlock the power of advanced SEO tools and data-driven insights.

          Start my free trial
          Products
          • Moz Pro
          • Moz Local
          • Moz API
          • Moz Data
          • STAT
          • Product Updates
          Moz Solutions
          • SMB Solutions
          • Agency Solutions
          • Enterprise Solutions
          Free SEO Tools
          • Domain Authority Checker
          • Link Explorer
          • Keyword Explorer
          • Competitive Research
          • Brand Authority Checker
          • Local Citation Checker
          • MozBar Extension
          • MozCast
          Resources
          • Blog
          • SEO Learning Center
          • Help Hub
          • Beginner's Guide to SEO
          • How-to Guides
          • Moz Academy
          • API Docs
          About Moz
          • About
          • Team
          • Careers
          • Contact
          Why Moz
          • Case Studies
          • Testimonials
          Get Involved
          • Become an Affiliate
          • MozCon
          • Webinars
          • Practical Marketer Series
          • MozPod
          Connect with us

          Contact the Help team

          Join our newsletter
          Moz logo
          © 2021 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
          • Accessibility
          • Terms of Use
          • Privacy

          Looks like your connection to Moz was lost, please wait while we try to reconnect.