2

I've installed a WordPress Network using subdomains on an existing install, to make an english version of my current site (in french), but I get a 404 error on the new subdomain site. If I create a subdomain myself via ftp the subdomain is found in the browser but wordpress doesn't see it (and if I've understood, wordpress doesn't need an actual subdomain folder as it will make a virtual one in the database).

I've tried modifying the DNS with help from someone on the WP forum (https://wordpress.org/support/topic/multi-site-install-original-site-is-fine-500-error-on-the-new-subdomain/) but no success so far; he suggested I try here. It seems likely the problem lies with the server (Apache/2.4.10 (Ubuntu)), but I can't access the server at my hosting company and the support there says they can't either, and that I should modify the htaccess.

I need to set up ideally a wildcard subdomain "*" or else a subdomain called "en" which will go to the folder where my wordpress install is, called "www". The wildcard subdomain was already set up in the DNS and should also be on the server, but I have no way of checking (or creating it).

What should I add to the htaccess to tell the server to send all subdomains to the wordpress install ? (Or alternately is there something else I should do ?)

Currently the htaccess contains this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

</IfModule>

# END WordPress

These are my current DNS settings. "bobo" is a test subdomain. DNS

Here is a screenshot of the server via ftp. The wordpress install is inside the www folder, according to the instructions from my host. ftp

Let me know what other information you might need.

I am not a dev but I can modify the htaccess and upload it via ftp. I just have no clue what to write in it. I can modify the DNS as well, if necessary. My host (online.net) doesn't use CPanel. I have access to some admin tools on their site.

Any help is greatly appreciated.

zelda013
  • 23
  • 4
  • "create a subdomain myself via ftp" - How do you "create a subdomain via FTP"?! "...but I have no way of checking (or creating it)." - if you are getting a 404 (presumably from your site?) then the wildcard subdomain would seem to already be set up correctly as far as the server is concerned? – MrWhite Oct 06 '18 at 23:38
  • I created a folder via ftp, it's one of the methods proposed by my host (online.net). You can see the folder in the screencap of my ftp (in the original post). However this is not the right method for wordpress, as the subdomain will be managed in the database. My original site is fine ; but when I try to access the newly-created site in the subdomain, I can't. To be clear, the 404 error is on the wordpress dashboard of the new subdomain site. – zelda013 Oct 09 '18 at 15:51
  • By the way I've created a new subdomain site in the Network dashboard WITHOUT creating a folder via ftp, I am getting a 500 error on the dashboard for that site: "The domain / subdomain has not been found. Error 500." – zelda013 Oct 09 '18 at 16:38
  • "I created a folder via ftp" - Creating a folder has nothing to do with creating a subdomain. (?) And neither does a subdomain need a specific folder. If you are using WP with _subdomains_ then I don't think you should have separate subdirectories (for the subdomains to point to) - all the subdomains should point to the same place on the filesystem so that the WP front-controller can manage them all. – MrWhite Oct 09 '18 at 17:00
  • Wildcard subdomains are not defined in `.htaccess` (as your title suggests). If `subdomain.example.com` resolves to your site and returns a 404 (as you suggested initially), or some other _valid response_ then the "wildcard subdomain" would seem to be already configured? Which perhaps suggests a WP config issue? You may get a better response on the WordPress stack: https://wordpress.stackexchange.com/ – MrWhite Oct 09 '18 at 17:05
  • 1
    Thanks MrWhite for reply. My host specifically references ftp subdomains (https://documentation.online.net/fr/web/domain-name/subdomains-creation#creation_d_un_sous-domaine_depuis_un_client_ftp_mode_avancee) so I used the same term thinking it had something to do w/ their server config. They also told me to configure the htaccess for wildcard subdomains. It turns out they are not a reliable source of information, and the reason I was having problems is because wordpress multi-support is simply not supported there. I am switching to a new host instead (ovh). I'll keep the wp stack for ref. – zelda013 Oct 10 '18 at 17:31
  • This question can be closed now. I don't know how to do that. – zelda013 Oct 10 '18 at 17:31
  • The "ftp subdomain" thing is possibly unique to online.net? That's not "normal". (Bearing in mind I'm translating that document to English...) Creating a subdirectory (or folder) in the FTP client simply creates a subdirectory - nothing more. What it looks like they may be doing is _automagically_ mapping subdomains (using the _wildcard_ CNAME record in DNS) to a subdirectory of the same name? (Which would require additional directives in the server config to work.) But I'm guessing. That would "work like magic" if it's something you require, but very annoying and restricting if not. – MrWhite Oct 10 '18 at 23:27
  • Yes I've come to the conclusion that online is definitely not a reference for any of this stuff. I was suprised too that they suggested using ftp to create a subdomain but since I know nothing about servers I thought maybe it was just something I didn't know. Either way the real problem is they can't do what I need to do (and that it's nearly impossible to get reliable / complete information from them). I'll definitely keep in mind that ftp sub-directories are in fact a myth from now on though, glad to have that confirmed. – zelda013 Oct 11 '18 at 13:49

1 Answers1

1

For WordPress multi-site you don't want the subdomain to point to a subdirectory off the document root - which would seem to be the problem here. As you state in your question, you need the subdomain to point to the document root (the www subdirectory) where WordPress multi-site is installed.

All that is required is the * CNAME entry in DNS (which seems to already be configured from the information you linked to) and a wildcard entry in your server config of the form:

ServerAlias *.example.com

If the "wildcard" ServerAlias is not defined and you are forced to have subdomains that map to same-name subdirectories off the document root then that would seem to be the problem.


Just to reiterate what I mentioned in comments... you can't create subdomains using an FTP client. All you're doing is creating a subdirectory. If the host (online.net) is automagically mapping (wildcard) subdomains to subdirectories of the same name (off the document root) then this would seem to be unique to your host.

MrWhite
  • 12,647
  • 4
  • 29
  • 41
  • 1
    Thanks MrWhite for these details. It turns out that my host does not allow the necessary server configuration so my problem is down to the fact that it's just not possible there. It's annoying they couldn't give me better info earlier because I lost a week trying to figure this out and in fact the only solution is, switch to a different host. :/ I'm going with OVH instead of online, from the research I've done *apparently* there is no problem with the server config there. Hopefully this will all be sorted as soon as I migrate. – zelda013 Oct 11 '18 at 13:43