Maor Barazany
Maor Barazany

Reputation: 761

WordPress Multisite install in a subfolder won't work with www

I have a domain - www.mydomain.com Inside there is a folder with Multisite install - www.mydomain.com/sites Multisite is installed with subfolders. I have a site, let's say - www.mydomain.com/sites/mysite.

Now, when brwosing to www.mydomain.com/sites and to mydomain.com/sites (without www) - both work. When browsing to www.mydomain.com/sites/mysite - works well too. But - when browsing to mydomain.com/sites/mysite (without the leading www), so it's being redirected to the main site - www.mydomain.com/sites instead to the specific mysite.

I figured out it may be related to WP multisite that is main site located in a subfolder, but couldung figure out how to make mydomain.com/sites/mysite redirect to www.mydomain.com/mysite as expected.

p.s I use fresh install of latest WP

Upvotes: 0

Views: 85

Answers (1)

krishna89
krishna89

Reputation: 846

Try to add this code in your .htaccess file of wordpress installations in subfolders.

for HTTP:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

for HTTPS:

RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^(.*)$ http%1://www.%{HTTP_HOST}/$1 [R=301,L]

Upvotes: 1

Related Questions