I know there are a million articles, but I have not been able to resolve this issue. We're running ISPConifig 3.2.12 in multi-server mode. Webserver is running Apache on Ubuntu 22.04.5. In ISPConfig, we have a site of example com with a subdomain of staging.subdomain.com. DNS is configured and resolves. Problems are the initial request of subdomain.example.com is appended with staging.example/staging.com and returns a page error. Only part of the home page is loaded with a couple links. If I hover over the links, the correct url is listed (staging.example.com). However, clicking on the link brings back the staging.exmple.com/staging. I have been through the .htaccess and functions.php files to make sure there were no redirects there. In ISPConsig, I've got the host set to "staging" and the Redirect Path set to "/staging/" and have tried every option for the redirect type with various results but nothing that works properly. With a L redirect, even though the url reflects staging.example.com, the live site is rendered. To be clear a get for staging.example.com returns a url of staging.example.com but the pages loaded are the live site. I've tested with test html files in each to verify. Any suggestions?
Have you created subdomain.example.com as a new website in ISPConfig (or at least as a vhost subdomain)? As that's what is recommended for a staging site. Never put the staging site in a subdirectory of your main site using a subdomain (not vhost).
Hmm, no, I created a subdirectory named staging within the web directory. In referring back to the ISPConfig manual and was under the impression you could do it either the way that I did (4.6.1.2) or you could do a Vhost (4.6.1.3). Since it's not working the way I did it. I'll try the Vhost. Thanks for your feedback Till.
Well, that ends up with the same. I deleted the original subdomain and created a new Subdomain (Vhost) for staging.exmple.com, pointing to web/staging and also a new db which is a copy of the live db. Accessing staging.exmple.com renders the home page but any links or menu items return the live site's page, not the subdomain's pages. If I manually change the url from www.exmple.com to staging.exmple.com, the page is returned We are trying to set up a staging site that will allow us to modify pages before making changes to the live site. Any suggestions would be greatly appreciated. One other thing, how do you add a cert to the subdomain? When i try to add a cert, it fails. I've tried a commercial wildcard cert we use for the live site and other services and also have tried with a Let's Encrypt cert, but neither work.
As I mentioned, I recommend using a separate site to ensure that your staging site does not interfere with the main site, which can result in staging or the main site failing. Putting the vhost subdomain inside the web folder can have the same result, so I won't do that on my systems. The simple reason is that the settings and rewrite rules of both sites can possibly interfere with each other if you set it up like that. Have you set the new domain in the CMS and cleared the cache of the CMS? In most CMS and shop systems today, you must set the domain. if you do not do that for the staging site, it will show the main site as in your case. That#s not a setting in ISPConfig, its in your CMS. Just enable the Let's encrypt checkbox of the site. If it fails, take care that this subdomain exists in public DNS and points to your server. Also see Let's Encrypt error FAQ post.
I'm confused by separate site not in the web folder. Do you mean creating a new vhost site of staging.example.com as a completely new site? If so, the vhost setup looks for the web folder. does it matter what is entered? Or do you mean create the staging.example.com in example.com/staging rather that example.com/web/staging? Thanks.
Create a new website, enter staging.example.com into the domain field, and configure it exactly as the original website. That's the most secure way to ensure that your staging website will behave identically to the main website.