This is a hypothetical right now… but we have a few clients with sites built with WP and hosted on SiteGround and this builds the apex domain (eg. examples.com). We are looking creatinga few static demo pages for their product via Gatsby and would like to deploy it using Netlify but would like to form it as a subdirectory of said domain (eg. examples.com/demo/*). Is there a way to acheive this?
If you’re having the WP on a subdomain, that is, eg.examples.com and want Netlify on examples.com/demo/, it’s fairly easy. In your domain’s DNS settings, point the A + CNAME records to the Netlify records for your apex domain and publish the website with a redirect to redirect examples.com to examples.com/demo/. Then, create a subdomain for your WP website inside your DNS settings to point to the SiteGround thing.
Oh, then I guess, proxy redirects are the only solution. I don’t know how you can do it there, but sadly there’s nothing on Netlify end that you can do.
If however, you don’t need the URL to look like example.com/demo/ in the address bar, the simplest solution would be to use a 301 redirect.
Why not setup a subdomain on the apex domain - then just point that to Neltify?
Having it under a sub directory seems un necessarily complicated for a proof of concept - like @hrishikesh mentioned - you would need to setup proxy redirects.
Very valid point, as a developer I would like to stop at subdomain but some client of ours would prefer subdirectory over subdomain due to ‘SEO values’. We would test the theory hence we are looking for a solution to make this happen. Can i use Netlify’s proxy redirect to achieve this?
If you were using Netlify as the hosting for the apex domain then, yes (but you won’t be so you can’t).
If the apex domain hosting is at the WP host (SiteGround), that hosting is handling the HTTP request and they would need to proxy to Netlify in some way. Note: we strongly recommend against proxying to Netlify. Proxying from Netlify to other hosting is fine but we do not recommend proxying to us.
If you use the subdomain method (instead of the “sub-path” method), Netlify hosts the subdomain directly and there is no proxying involved.
I want to mention, you can stop search engines from indexing certain sites or pages so SEO won’t be impacted:
If you don’t want the test sites indexed, please use one of those methods to prevent it and no SEO impact will occur. Alternatively, you can also enable site-wide password protection on the test sites so SEO isn’t affected but this feature is only available on Pro plan teams or above.