• Hello, I have WordPress Multisite installed so that I can run 2 different websites from the same hosting account. Let’s call them “site1.com” and “site2.com”

    The problem is that any misspelled URL’s redirect the user to the index page of only one site. So assuming that “missing_page.html” doesn’t exist on my server, trying to access “site1.com/missing_page.html” redirects to “site1.com” (as intended) BUT trying to access “site2.com/missing_page.html” ALSO redirects to “site1.com”, when I want it to redirect to “site2.com”.

    I understand that the .htaccess file should handle this kind of thing, but I’m really lost as to how. Can you offer any info on what I should be doing?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • It is correct that the rules in .htaccess must be modified accordingly. Please check on this guide – https://codex.ww.wp.xz.cn/htaccess

    Thread Starter samuelthomson

    (@samuelthomson)

    Hello,

    I’ve read that page, but I’m really confused as to how I’m supposed to change the examples to direct “file not found” errors to my home page. So far I have the following (I replace mysite with my actual domain name):

    RewriteCond %{HTTP_HOST} ^mysite\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.mysite\.com$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^/?$ “http\:\/\/mysite\.com\/” [R=301,L]

    Can you suggest where I might be going wrong? I also found the following suggested code, but this just led to an absolute minimal 404 error page:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)special\.html?$ cgi-bin/special/special-html/$1

    johngoold

    (@johngoold-1)

    I think you are using the wrong approach to hosting two websites on a single web hosting account. You should be using some kind of “add-on domain”. If you are using an inexpensive hosting provider, you may not be able to do that, but I think most give at least some ability to handle add-on domains.

    If you take that approach, then site1.com and site2.com resolve to their own directories and you can handle Page Not Founds appropriately.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Changes to .htaccess for multisite’ is closed to new replies.