Trouble with WordPress Multisite with subdomain using custom .htaccess-file
-
Hi
I’ve set up a WordPress Multisite using subdomains.
On before hand I checked with the ISP if thay supported wildcard DNS. They did provide it automaticly when you setup your account. So that was taken care of.
They allso gave me a custom .htaccess file to get it all to work properly on their servers. This goes as follows:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On #rewriting wordpress stuff to the root RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^/wp-((content|admin|includes)|((cron|login)\.php)) RewriteCond %{HTTP_HOST} ([a-zA-Z0-9-]+\.([a-z]{2,4})|co\.uk|me\.uk|org\.uk|priv\.no)$ RewriteRule ^(.*)$ https://%1/%{REQUEST_URI} [L,QSA] #rewriting everying that can't be found to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^index\.php$ - [L] # uploaded files RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L] #rewriting everything else to index.php RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteCond %{REQUEST_URI} !^/wp-(content|admin|includes|login|cron)(\.php)? RewriteRule . index.php [L] </IfModule> # END WordPress
As opposed to the .htaccess setup suggested by WordPress itself:
# 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
I have of course tested both setups. The setup suggested by WordPress does not work for the subdomains (https://test.bonitas.no), its giving me 404-errors. The main site https://www.bonitas.no works perfectly both front end and back end. The network back end works aswell.
The .htaccess setup provided by the ISP gives me access as above. And now to the subdomain test.bonitas.no front end. But when I try to access the backend https://test.bonitas.no/wp-admin I’m rerouted to this address: https://www.bonitas.no/wp-signup.php?new=bonitas.no (there is no error messages, and the page shown is the same as https://www.bonitas.no).
I don’t know anything about .htaccess and RewriteRule etc. So bear over with me. But as far as my sense goes, I think that the following rule might be the culprit?
RewriteCond %{HTTP_HOST} ([a-zA-Z0-9-]+\.([a-z]{2,4})|co\.uk|me\.uk|org\.uk|priv\.no)$ RewriteRule ^(.*)$ https://%1/%{REQUEST_URI} [L,QSA]
I’m in dialog with the ISP’s support, but I guess that they really don’t know either.
Any suggestion from you experts will be greatly appreciated.
- The topic ‘Trouble with WordPress Multisite with subdomain using custom .htaccess-file’ is closed to new replies.