1

I want to use Wordpress to manage all sub-domains but not as a multi-site. So in essence all subdomains will show the same wordpress site (*.domain.com -> shows same wordpress site).

Is that possible and how?

  • 1
    Can you just add a DNS record that maps that wildcard to your wordpress site? – Brian Wheeler Jan 09 '15 at 19:14
  • Yes so it will show the same site - but wordpress permalinks will always show the url of the site to which it was installed. For example, I install the site on wildcard.domain.com and then point a wildcard subdomain to the site - then the site will show up for all subdomains. But every link on the pages will be for wildcard.domain.com and not subdomain.domain.com – Stefan Morrow Jan 09 '15 at 21:02

3 Answers3

2

I found the answer to my question over here: http://www.plankdesign.com/blog/2013/10/making-wordpress-more-portable/

Simply add the following lines to wpconfig.php:

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);

And it will automatically reflect according to subdomain.

1

I think you can do that in your cPanel, when you create each of these subdomains use the main domain document root for them. In this way you will have all the subdomains use the same main folder.

Mouhamad Kawas
  • 370
  • 2
  • 12
0

You can use your .htaccess file to redirect subdomains to your main wordpress site.

RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

this will make any www.example.com redirect to example.com

RewriteCond %{HTTP_HOST} ^othersubdomain.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

will make othersubdomain.example.com redirect to http://example.com. In this fashion, you can cover the subdomains you expect your users to visit.

Is that what you want? All of them will be the exact same website, which seems like what you want.

aaron-coding
  • 2,571
  • 1
  • 23
  • 31
  • Hi Aaron, no - that would be redirecting all subdomains - the goal is to show the same site for each subdomain while retaining the subdomain url. – Stefan Morrow Jan 09 '15 at 20:44
  • 1
    Ok. I understand. Just as a warning, if you care about Google Results, Google does not like duplicate content, and several subdomains with the same content is considered duplicate content: https://support.google.com/webmasters/answer/66359?hl=en Good luck your implementation. – aaron-coding Jan 09 '15 at 20:46
  • Hi Aaron, I know - this is not relevant - it is a landing page that is meant to look the same for all subdomains but will populate different referral codes and other values based on subdomain. – Stefan Morrow Jan 09 '15 at 20:49