Sub-subdomain getting redirected to main domain
Sub-subdomain getting redirected to main domain
Sub-subdomain getting redirected to main domain
You need to check if the siteurl differs from the home URL: if ( get_option( ‘siteurl’ ) !== get_option( ‘home’ ) ) { // whatever This also works if home is a subdirectory of the root, with WordPress installed in yet another subdirectory. For example: domain.com/blog (URL) and domain.com/blog/wordpress (siteurl).
The fact that you haven’t mentioned MultiSite in your post makes me think that doing some research there would be a good next step for you: https://codex.wordpress.org/Create_A_Network User Accounts are shared across sites in the network, and sites can be different subdomains.
It’s better not to use these sort of subdomain redirect rules within WordPress: WordPress may not load properly when you access it using the wrong domain name or sub-domain, as a typical WordPress installation is set to run for a particular domain or subdomain. Even if you are able to make it work, before every … Read more
WP multisite (subdomain) is the answer – http://codex.wordpress.org/Create_A_Network In addition you can install the WP Domain Mapping Plugin to run on other domains You need to decide whether you want WP multisite subdomain or sub-directory installation. WP subdomain does exactly what you want, but WP subdir + domain mapping plugin allows you to have both … Read more
The WP Codex gives two examples of excluding a subdirectory from multisite’s control. .htaccess method (as Karthik noted) Virtual host method .htaccess Being sure to call the sub rewrite BEFORE the rewrite of ww.domain.com to domain.com RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} subdomain.domain.com RewriteCond %{REQUEST_URI} !subdomain/ RewriteRule ^(.*)$ subdomain/$1 [L] # Rewrite http://www.domain.com to domain.com … Read more
Let’s establish the baseline: it is possible to have the main site in example-domain-x.com and all subsites subdomains in example-domain-y.com. You just add subdomain1.example-domain-y.com (or subdomain2.example-domain-y.com, subdomain3.example-domain-y.com) like you would be adding a bare or www domain in the domain mapping panel ( URL containing wp-admin/network/settings.php?page=dm_domains_admin ). To achieve the same programmatically, you could hook … Read more
Based on Charles Clarkson’s comment, I directly changed the siteurl and home options in the wp_options table to be https://dev.example.com/ and this fixed the problem for me.
You can move the uploads folder to the sub domain by doing this Open up your wp-config.php file, located at the root of your WordPress installation, and add the following code: define(‘UPLOADS’, ‘http://images.mydomain.com/uploads’); The codex specifies that it should be added before the line that says require_once(ABSPATH.’wp-settings.php’);. Make sure the uploads folder is writable.
This question is getting a little old, but since I came across it looking for other related things I thought it deserved an answer. The answer provided on that other link you included is actually the spot-on correct answer here too. It goes into more detail, but I will summarize here. What you want to … Read more