• Resolved Stettin

    (@stettin)


    I currently have hosting through HostGator that allows me to host multiple domains. I mainly host different WP blogs, but I’ve moved to some other style sites. My problem is that if someone types in a bad URL for one of my alternate domains, it gets routed to my /index.php

    My wordpress install is located in /blog, but I didn’t like that extra part, so have it set up so that the blog shows up in the root, /index.php. I’ve tracked down the problem to the htaccess code wordpress needs to work. If I remove it, the 404 pages work for the other sites, but it breaks my WP install (pages not found). After some research I see why it is breaking. If there isn’t a real file or directory, it routes the request to /index.php. Does anyone know a way around this?

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

Viewing 7 replies - 1 through 7 (of 7 total)
  • Shouldn’t you have the htaccess in the folder which points to the domain, therefore the other domains shouldn’t even see this or take it into account?

    Or do you not have seperate folders set up for your seperate domains?

    Thread Starter Stettin

    (@stettin)

    my structure is

    / (domain one)
    .htaccess
    /domain2
    /domain2/.htaccess (domain2)
    /domain3
    /domain3/.htaccess (domain3)

    It seems that the /.htaccess is overwriting the 404 functionality of the subdirecotries/domains

    So for domain2 htaccess it’s like this:

    domain1/domain2/.htaccess

    If so why is domain2 folder in domain1, unless it’s a sub-domain?

    The WordPress .htaccess files should only be in the domain folders that have WordPress installed, so it can no way affect the other domains.

    Thread Starter Stettin

    (@stettin)

    OK, let me clarify.. I think I laid that tree out kind of funky

    my root website is https://www.mydomain.com
    blog is in https://www.mydomain.com/blog, but I didn’t like the /blog at the end, so all of my posts show up as https://www.mydomain.com/blogpost.htm

    each domain has its own directory off of the root
    / – https://www.mydomain.com
    /domain2 – https://www.domain2.com
    /domain3 – https://www.domain3.com

    They are not subdomains, but full domains. HostGator uses Cpanel, if that helps

    I do have a subdomain for a clan website running WordPress
    /clan – clan.mydomain.com

    WordPress handles the 404pages just fine as either a domain or subdomain. I think it is because each wordpress install has its own .htaccess file with mod-rewrite, but the non-wordpress do not.

    So if somebody types in a bad URL for one of your alternate domains which do not have WP installed where would you like the page to go to instead of index.php ?

    For the other sites you just add something like:

    ErrorDocument 404 /404.html

    Inside a .htaccess file and when recieving a 404 it will re-direct to 404.html

    Thread Starter Stettin

    (@stettin)

    I have that in the subdirectory…

    ErrorDocument 404 /404.shtml

    I think the problem is the root htaccess is kicking in before the subdirectory htaccess. I thought it was supposed to read the subdirectory htaccess first.

    Thread Starter Stettin

    (@stettin)

    I got my solution! Thanks to HostGator tech support for the answer: I needed to add this to my .htaccess file….

    RewriteEngine Off

    Once I did that, the 404 errors showed up fine ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘htaccess affecting other sites on multiple domain host’ is closed to new replies.