WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Multisites Work actual subdomains being redirected (19 posts)

  1. brad1004
    Member
    Posted 4 years ago #

    Hi there
    This has had both me and my host going around in circles for the last 3 days
    I have got ( just updated) WordPress .3 RC3 multisites enabled.
    I have added the wildcard *.mysite.com A record.
    My host has added the ServerAlias *mysite.com
    I have the basic htaccess file in place
    I am on a Linux Server using Plesk 9.3
    Ok so here goes. I have a couple of actual subdomains which work just fine until my host adds the ServerAlias to the Apache file and then my WordPress multisite works just fine creating and accessing my multiple blogs but when I try and access an actual suddomain it is redirected to this http://www.mysite.com/wp-signup.php?new=mysubdomain.mysite.com
    Removing the server alias and my WordPress stops working and my subdomains are fine
    Any will help will be greatly appreciated
    Brad

    Copy of my htaccess

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
  2. @mercime
    Volunteer Moderator
    Posted 4 years ago #

    To avoid conflict with your actual subdomain names
    Go to Super Admin > Options - Registration Settings - Banned Names = names of actual subdomains
    e.g. if you have actual subdomain sites at site23.yoursite.com, site24.yoursite.com and site25.yoursite.com, include site23 site24 and site25 in list of Banned Names

  3. ... and tell your host to put the "real" subdomain records above the wildcard record. So apache will look up existing ones first, then use the wildcard if it can't find it.

  4. brad1004
    Member
    Posted 4 years ago #

    Hi - Thank you both for your suggestions I have added my two actual subdomains to the Banned names and my host has also added these subdomains to my Apache config file above the wildcard entry.
    Results - absolute no change - I am still being redirected as before
    Any further help would be appreciated
    Is anyone else using actual and wildcard subdomains successfully ?
    Brad
    P.s have also updated to the latest build

  5. brad1004
    Member
    Posted 4 years ago #

    Hi I am still going around in circles with this one and running out of ideas – any help would be greatly appreciated
    Brad

  6. and my host has also added these subdomains to my Apache config file above the wildcard entry.

    Do you have access to the file? Xan they paste the lines somewhere so everyone can read them?

    Yes, lots of other people have done this successfully. :)

  7. brad1004
    Member
    Posted 4 years ago #

    Hi Just waiting for the code to come through and will post it

    Excuse my ignorance again but could it have something to do with the www. My main site is called http://www.mysite.com in the WordPress panel and under options the recommended network admin email address is support@www.mysite.com
    My config file has my site listed as http://www.mysite.com

    Thanks
    Brad

  8. @mercime
    Volunteer Moderator
    Posted 4 years ago #

    WPMU never did like www, and I don't know if that's the same in MS since I prefer no www myself :-)

    Having said that ...

    1) check your database via phpMyAdmin and look for following:
    yourprefix_1_options/yourprefix_options and yourprefix_blogs
    a) in yourprefix_1_options/yourprefix_options, check option_name of siteurl if it has http://www.yoursite.com then set option_name of home to http://www.yoursite.com
    b) in yourprefix_blogs, check if the www is there in url and update if none

    2) in wp-config.php check/correct site URL
    define('DOMAIN_CURRENT_SITE', 'yoursite.com' );
    to
    define('DOMAIN_CURRENT_SITE', 'www.yoursite.com' );

    ... WRONG - define('DOMAIN_CURRENT_SITE', 'http://www.yoursite.com' );

  9. brad1004
    Member
    Posted 4 years ago #

    Ok so I have now done a new install on a test site (same host) to deal with the www. issue which now proves that is not an issue at all

  10. brad1004
    Member
    Posted 4 years ago #

    Hi Please find a copy of the code below

    Iv'e been told that -
    This lives external to the core config within a separate vhost.conf

    [root@myhosting conf]# cat vhost.conf
    ServerAlias *.mysite.com

    This is the way Plesk implements bespoke configurations. You will see the include for vhost.conf at the bottom of the main configuration file. - Also mentioned by my host -

    Thanks
    Brad

  11. brad1004
    Member
    Posted 4 years ago #

    And here is the actual file

    # ATTENTION!
    # DO NOT MODIFY THIS FILE OR ANY PART OF IT. THIS CAN RESULT IN IMPROPER PLESK
    # FUNCTIONING OR FAILURE, CAUSE DAMAGE AND LOSS OF DATA. IF YOU REQUIRE CUSTOM
    # MODIFICATIONS TO BE APPLIED TO THE CONFIGURATION, PLEASE, PERFORM THEM IN THE
    # FOLLOWING FILE(S):
    # /var/www/vhosts/mysite.com/conf/vhost.conf
    # /var/www/vhosts/mysite.com/conf/vhost_ssl.conf
    # /var/www/vhosts/mysite.com/subdomains/<subdomain-name>/conf/vhost.conf
    
    <IfModule mod_ssl.c>
    
    <VirtualHost 10.10.10.101:443>
            ServerName   mysite.com:443
            ServerAlias  www.mysite.com
            UseCanonicalName Off
                    SuexecUserGroup         me123 psacln
            ServerAdmin  Myhost@Myhost.com
            DocumentRoot /var/www/vhosts/mysite.com/httpdocs
            CustomLog  /var/www/vhosts/mysite.com/statistics/logs/access_ssl_log plesklog
            ErrorLog  /var/www/vhosts/mysite.com/statistics/logs/error_log
    <IfModule mod_userdir.c>
            UserDir /var/www/vhosts/mysite.com/web_users
    </IfModule>
            ScriptAlias  /cgi-bin/ /var/www/vhosts/mysite.com/cgi-bin/
            Alias  /plesk-stat /var/www/vhosts/mysite.com/statistics/
            <Location  /plesk-stat/>
                    Options +Indexes
            </Location>
            <Location  /plesk-stat/logs/>
                    Require valid-user
            </Location>
            Alias  /webstat /var/www/vhosts/mysite.com/statistics/webstat
            Alias  /webstat-ssl /var/www/vhosts/mysite.com/statistics/webstat-ssl
            Alias  /ftpstat /var/www/vhosts/mysite.com/statistics/ftpstat
            Alias  /anon_ftpstat /var/www/vhosts/mysite.com/statistics/anon_ftpstat
            Alias  /awstats-icon /var/www/html/awstats/icon
            SSLEngine on
            SSLVerifyClient none
            SSLCertificateFile /usr/local/psa/var/certificates/certBde8111
            <Directory /var/www/vhosts/mysite.com/httpdocs>
            <IfModule mod_perl.c>
            <Files ~ (\.pl$)>
                    SetHandler perl-script
                    PerlHandler ModPerl::Registry
                    Options ExecCGI
                    allow from all
                    PerlSendHeader On
            </Files>
            </IfModule>
            <IfModule sapi_apache2.c>
                    php_admin_flag engine on
                    php_admin_flag safe_mode off
                    php_admin_value open_basedir "/var/www/vhosts/mysite.com/httpdocs:/tmp"
            </IfModule>
            <IfModule mod_php5.c>
                    php_admin_flag engine on
                    php_admin_flag safe_mode off
                    php_admin_value open_basedir "/var/www/vhosts/mysite.com/httpdocs:/tmp"
            </IfModule>
            <IfModule mod_fcgid.c>
                    <Files ~ (\.fcgi)>
                            SetHandler fcgid-script
                            Options +FollowSymLinks +ExecCGI
                    </Files>
            </IfModule>
                    SSLRequireSSL
                    Options +Includes +ExecCGI
            </Directory>
            <Directory /var/www/vhosts/mysite.com/web_users>
            <IfModule sapi_apache2.c>
                    php_admin_flag engine off
            </IfModule>
            <IfModule mod_php5.c>
                    php_admin_flag engine off
            </IfModule>
            </Directory>
    </VirtualHost>
    
    </IfModule>
    
    <VirtualHost 10.10.10.101:80>
            ServerName   mysite.com:80
            ServerAlias  www.mysite.com
            UseCanonicalName Off
            SuexecUserGroup         me123 psacln
            ServerAdmin  "Myhost@Myhost.com"
            DocumentRoot /var/www/vhosts/mysite.com/httpdocs
            CustomLog  /var/www/vhosts/mysite.com/statistics/logs/access_log plesklog
            ErrorLog  /var/www/vhosts/mysite.com/statistics/logs/error_log
    <IfModule mod_userdir.c>
            UserDir /var/www/vhosts/mysite.com/web_users
    </IfModule>
            ScriptAlias  /cgi-bin/ /var/www/vhosts/mysite.com/cgi-bin/
            Redirect permanent /plesk-stat https://mysite.com/plesk-stat
            Redirect permanent /webstat https://mysite.com/webstat
            Redirect permanent /webstat-ssl https://mysite.com/webstat-ssl
            Redirect permanent /ftpstat https://mysite.com/ftpstat
            Redirect permanent /anon_ftpstat https://mysite.com/anon_ftpstat
            Redirect permanent /awstats-icon https://mysite.com/awstats-icon
            <IfModule mod_ssl.c>
                    SSLEngine off
            </IfModule>
            <Directory /var/www/vhosts/mysite.com/httpdocs>
            <IfModule mod_perl.c>
            <Files ~ (\.pl$)>
                    SetHandler perl-script
                    PerlHandler ModPerl::Registry
                    Options ExecCGI
                    allow from all
                    PerlSendHeader On
            </Files>
            </IfModule>
            <IfModule sapi_apache2.c>
                    php_admin_flag engine on
                    php_admin_flag safe_mode off
                    php_admin_value open_basedir "/var/www/vhosts/mysite.com/httpdocs:/tmp"
            </IfModule>
            <IfModule mod_php5.c>
                    php_admin_flag engine on
                    php_admin_flag safe_mode off
                    php_admin_value open_basedir "/var/www/vhosts/mysite.com/httpdocs:/tmp"
            </IfModule>
            <IfModule mod_fcgid.c>
                    <Files ~ (\.fcgi)>
                            SetHandler fcgid-script
                            Options +FollowSymLinks +ExecCGI
                    </Files>
            </IfModule>
                    Options +Includes +ExecCGI
            </Directory>
            <Directory /var/www/vhosts/mysite.com/web_users>
            <IfModule sapi_apache2.c>
                    php_admin_flag engine off
            </IfModule>
            <IfModule mod_php5.c>
                    php_admin_flag engine off
            </IfModule>
            </Directory>
            Include /var/www/vhosts/mysite.com/conf/vhost.conf
    </VirtualHost>
    
    <VirtualHost 10.10.10.101:80>
            ServerName   1helpdesk.mysite.com:80
            SuexecUserGroup         me123 psacln
            ServerAdmin  "Myhost@Myhost.com"
            DocumentRoot /var/www/vhosts/mysite.com/subdomains/1helpdesk/httpdocs
            CustomLog  /var/www/vhosts/mysite.com/statistics/logs/access_log plesklog
            ErrorLog  /var/www/vhosts/mysite.com/statistics/logs/error_log
            ScriptAlias  /cgi-bin/ /var/www/vhosts/mysite.com/subdomains/1helpdesk/cgi-bin/
            <IfModule mod_ssl.c>
                    SSLEngine off
            </IfModule>
            <Directory  /var/www/vhosts/mysite.com/subdomains/1helpdesk/httpdocs>
            <IfModule sapi_apache2.c>
                    php_admin_flag engine on
                    php_admin_flag safe_mode off
                    php_admin_value open_basedir "/var/www/vhosts/mysite.com/subdomains/1helpdesk/httpdocs:/tmp"
            </IfModule>
            <IfModule mod_php5.c>
                    php_admin_flag engine on
                    php_admin_flag safe_mode off
                    php_admin_value open_basedir "/var/www/vhosts/mysite.com/subdomains/1helpdesk/httpdocs:/tmp"
            </IfModule>
            <IfModule mod_fcgid.c>
                    <Files ~ (\.fcgi)>
                            SetHandler fcgid-script
                            Options +FollowSymLinks +ExecCGI
                    </Files>
            </IfModule>
                    Options -Includes +ExecCGI
            </Directory>
    </VirtualHost>
  12. brad1004
    Member
    Posted 4 years ago #

    Hi All

    Update

    Ok so I have given up on using actual and virtual subdomains through Plesk panel - If you search this forum for plesk problems you will find that many people have had similar problems.

    I did however find someone do stated they had found a way around at least using your webmail with virtual subdomains and will include their solution below.
    I have not tested this solution

    If you have a Virtual Private Server [VPS] on a CentOS and use Plesk as a control panel and want to add Wildard “*” DNS entry while still maintaining webmail.domain.com, then you have come to the right place.

    Throughout the steps, replace domain.com with your actual domain name.

    When you add ServerAlias *.domain.com to the vhost.conf file, the already working webmail.domain.com will no longer work, as the wildcard will catch that.

    How to add Wildcard “*” DNS entry

    In your domain, select DNS Settings

    Click Add Record

    Select CNAME for Record Type; put * into domain name and domain.com for the canonical name. [You may use A record type too]

    Login to PowerPanel [Parallels Power Panel] as root

    - click File Manager
    - go to / var/ www/ vhosts/ domain.com/ conf/
    - there you’ll find httpd.include do not edit this. This is automatically updated by Plesk.
    - create/update another file vhost.conf
    - enter only

    ServerAlias *.domain.com

    - do not enter <VirtualHost inside the file. this file will be included inside httpd.include. So that syntax already exists.

    To run commands, you can use SSH Client. In PowerPanel, click “SSH Connection” and Login.

    - after the creation of vhost.conf file, we need to run the update. run the following. If no error message is displayed, then all is good.

    - # /usr/local/psa/admin/bin/websrvmng -av

    - whether the vhost.conf was new or not, you will need to reload the Apache configuration:

    - # /etc/init.d/httpd reload

    If you want, you can restart Apache using the command:

    - # /sbin/service httpd restart

    Now you have added the Wildcard “*” DNS Entry in both DNS Settings and vhost.conf. Let’s make sure AtMail is working.

    How to make AtMail working even after adding Wildcard “*” DNS entry

    Click File Manager

    - go to / etc/ httpd/ conf.d/

    You’ll see a file called

    zz_atmail_vhost.conf

    This is the AtMail configuration file. Because the filename starts with “zz” it is at the bottom of sort order. It is this order Apache processes the configuration. So we need to put this file just above zz010_psa_httpd.conf [in your server, you may not find exactly this file. You should find something similar to this name].

    So I just renamed our zz_atmail_vhost.conf to zz001_atmail_vhost.conf
    This put the file just above our zz010_psa_httpd.conf [note: I tried putting atmail_vhost.conf, which put it at the top, but that made viewing received emails impossible]

    Now you need to restart qmail.
    You can restart qmail using Plesk under Server -> Service Management. You can use ’service qmail restart’ on CentOS.

    Even after this, if you still not able to view received emails, just restart your container [PowerPanel].

    This is not necessary but you can rebuild Qmail configuration files using /usr/local/psa/admin/sbin/mchk utility.

    Test:

    check webmail.domain.com is working [make sure sending, receiving and able to read received emails working]
    check your wildcard dns working [that is your dynamic subdomains you may already have working]
    check any domain alias you may have working.
    check your main domain.com working

  13. gazouteast
    Member
    Posted 3 years ago #

    At this stage - after three weeks of going through a parallel process to this thread, my hosts, Plesk, and myself are on the edge of making a press release that WordPress 3.0+ Multisite will not work with Plesk on Unix cloud hosting.

    Collectively we have checked and rechecked EVERTHING, reinstalled countless times, even bought additional domain names and set up additional hosting accounts, and NOTHING prevents recurrence of the error reported at the top of the thread - that enabling wildcard subdomains for WP 3.0 disables fixedname subdomains for mail servers etc.

    Therefore a plea - if you DO have this working, please post your (anonymised) settings here or create a codex page for how to do it with UNIX and PLESK. (If you're using cPanel or Linux, please do not jump in - you'll only cloud the issue).

    Gaz

  14. WordPress 3.0+ Multisite will not work with Plesk on Unix cloud hosting.

    That seems a bit of a misstatement. At the very worst you mean to say that WP 3.0 MultiSite with subdomains doesn't work. And even that, I think, is incorrect.

    Aren't you REALLY saying that enabling wildcard subdomains ON A PLESK SEVER disables fixedname subdomains for mail servers etc.

    I would imagine this happens if you just added them in any way, without WordPress installed on the box. WordPress isn't what's telling the wildcards to supersede the named subdomains, after all. That's the server. You just tell it 'Point * at public_html' and WordPress accepts whatever comes in via the *.

  15. gazouteast
    Member
    Posted 3 years ago #

    ipstenu

    You just tell it 'Point * at public_html' and WordPress accepts whatever comes in via the *.

    EXACTLY - regardless of what subdomain name is setup in DNS and VHOSTS, then WP 3.0 grabs that subdomain as if it is a sub-blog and either loadfs it or redirects to the blog creation or registration page, regardless of whether or not the subdomain exists as a non WP subdomain or not.

    This did NOT happen under WPMU, it only happens under WPMS - we've even tried deleting WPMS and installing WPMU directly into the same domain folder in the hosting and WPMU worked perfectly with no other changes at all to the hosting setup or server files.

    What is the BIG change in WPMS compared to WPMU? The one that leaps out at me is that for some reason Automattic deprecated the WPMU VHOSTS function in favour of is_multisite() in the wp-config.php settings - I am certain it is related to that now.

    Andrea

    Seems to be a known issue with Plesk 9.

    I am also now getting it on cPanel installs that were working under WPMU and under 3.0, but since 3.0.1 are now exhibiting the same behaviour re: fixed subdomains being redirected to WPMS login or blog creation - this may explain why my personal inbox traffic locally has dropped from 300-500 mails a day down to under 50, and network wide for all local users, from over 2000 a day to under 200.

    I cannot even directly access those mailboxes per domain via Plesk or cPanel now - WPMS 3.0.1 has completely banjaxed the mail-based subdomains (hosts) set in DNS and made them inaccessible.

    Why did Automattic "fix" something that was not broken?

    Gaz

  16. gazouteast, man ... You're misunderstanding what WordPress, or ANY web app, does.

    WPMS 3.0.1 has completely banjaxed the mail-based subdomains (hosts) set in DNS and made them inaccessible.

    WordPress does not have the ability to redirect wildcard subdomains. It has the ability to interpret any wildcards that are set to it.

    Your SERVER setup says 'Any time *.domain.com comes in, send it to /public_html/'

    WordPress says 'Hey, I got a request for jimbo.domain.com!'

    Your SERVER is what says to pass the data to WordPress or not. WordPress has ZERO control over that.

    Basic laws of servers.

    What is the BIG change in WPMS compared to WPMU? The one that leaps out at me is that for some reason Automattic deprecated the WPMU VHOSTS function in favour of is_multisite() in the wp-config.php settings - I am certain it is related to that now.

    There is no VHOST funtion. There is a VHOST constant

    VHOST = virtual hosts, aka ServerAlias, aka PARSING Wildcard DNS

    If "no" blog urls look like http://mysite.tld/blog1 aka "sub-directories". If "yes" blog urls look like http://blog1.mysite.tld aka "sub-domains"

    So ... that's exactly what is_multisite() parses. And by the way, it's not is_multisite() in the wp-config, it's a CONSTANT.

    define( 'SUBDOMAIN_INSTALL', true );

    Much easier to understand for most of us, I think :)

    Look, I'm not saying you're wrong, but you're running down a path that is premature at best, and certainly a fair game at over-reacting.

    The number of people having this problem are VERY few. A handful on the forums (out of the probably 100k people using MultiSite). Occam's Razor being what it is, the problem is most likely in how you configured your server to parse wildcard domains.

    This works for a LOT of people. Windows and *nix, cPanel and Plesk, etc etc.

    If you REALLY think this is a BUG in WordPress, don't be a dink and threaten with a Press Release. Man up and do the right thing by the open community. Open a Bug report. List the details of your server info, provide your http.conf (or whatever you have) so people can see what it's set up as. If you're using brad1004's fix (renaming the vhost files so they are called before each other), list what yours are, complete with each file's content.

    But a theeat, man? That doesn't help anyone, least of all you.

  17. I am also now getting it on cPanel installs that were working under WPMU and under 3.0, but since 3.0.1 are now exhibiting the same behaviour re: fixed subdomains being redirected to WPMS login or blog creation -

    you need some old threads where the same thing was happening to a few people under mu?

    WordPress cannot manipulate the server for you. end of story.

    If it could do what you're claiming, then it could add the wildcard itself.

    Why did Automattic "fix" something that was not broken?

    Less than half of the core developers who worked on 3.0 work for Automattic. The rest are *volunteers*.

    those constants were renamed, but again, they do not mess with your server. they can't. If you tried it on cpanel and it did the same thing, again, we go back to your host.

    I have a few of my own installs on cpanel and they do not do this. Nobody but you is reporting this issue.

    Ipstenu is correct in everything she said.

    And if you cannot control your temper, I'll remind you of the forum rules posted here.

  18. mrmist
    Forum Janitor
    Posted 3 years ago #

    I'm uncertain as to why this thread has been hijacked into a discussion about wildcard hosting for email. If your email collection is being in any way affected by WordPress then you have a seriously messed up set of DNS entries. You don't need wildcard MX entries for WordPress, WordPress has nothing to do with MX entries. Your MX entry handler system would probably even be a completely different set of servers.

Topic Closed

This topic has been closed to new replies.

About this Topic