1 host, multiple domains and my 404 problem

Discussion in 'Programming' started by jeanm, Feb 15, 2016.

to remove all ads.
  1. jeanm

    jeanm Member

    Messages:
    150
    I have three websites all hosted together. The business website has a 404 page which works well: http://www.heritageceilings.com.au/404.php. I have realized this same page also shows up when a web page is mis-typed for my other two sites. I've spoken to the domains team at the place that hosts my websites and they tell me I can only have one dedicated 404 page and that it will show up for the two hobby websites as well as the business website. This is not workable or sensible so I've been searching for a solution online. I've been reading about .htaccess files. I've tried uploading one because I want it to go to this page: http://www.cheap-and-easy-recipes.com/404.php but the code I've used is not working. I have this code on a page I have called .htaccess

    ErrorDocument 404 http://www.cheap-and-easy-recipes.com/404.php

    Can anyone please tell me what I'm doing wrong? From what I've read I'm not sure I should be using .htaccess anyway. Is there a way that I can have a dedicated 404 page for each of the three sites whilst the three sites are all hosted together please? As you can tell, I'm totally clueless on this topic. If anyone can help me please phrase it so a simpleton can understand it.
     
  2. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,668
    .htaccess directives act on the physical structure of the hosting on a per directory basis NOT the HTTP: structure. Your problem says that your hosting is set up with "add on domains" being created in the document root of the primary domain files. This means that any .htaccess directives are ALSO applicable down the entire folder tree of all domains and any sub-domains.

    Placing a .htaccess file in every domain document root folder should allow you to override the conflicting rules, as the last directive applied should take precedence.
     
  3. jeanm

    jeanm Member

    Messages:
    150
    Thanks for your reply Chris. Are the domain document root folders something I have access to or is this something the provider has to do please? I just made up a .htaccess page and put it in with all the other pages on the site so I should delete that then?
     
  4. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,668
    You must have, or you would not be able to upload files for the website. If you login using a graphical FTP client or your control panel file manager you should see a folder tree something like the diagram below, the folder names may vary but the structure will be the same.


    general structure of a hosting folder tree
    Code:
    home
            |
            [accountname]---
                            |
                            | ---email folders are here [mail]
                            | ---site access log data [logs]
                            |
                            public_html   <<<<< This is the main 'document root' folder
                                |
                                |( primary site files and folders )
                                |(.htaccess here affects ALL folders here and below this point and in all branches)
                                |
                                |
                                |
                                |
                                |-----[addon domain folder 1]
                                |        | files for addon domain 1 (.htaccess here only affects folders in this branch)
                                |
                                |-----[addon domain folder 2]
                                |        | files for addon domain 2 (.htaccess here only affects folders in this branch)
                                |
                                |----- 
                                |
    
     
  5. jeanm

    jeanm Member

    Messages:
    150
    I’ve gone to Local Disc (C:)

    Selected: Users

    Found: Public (not public_html)

    I selected: Public Documents but that is empty.


    If I go this route:

    Local Disc (C:)

    Selected: Users

    Found: Public (again not public_html)

    Then select: Morrison4

    I’ve then found My Documents which includes heaps of folders, one of which has the three websites in it.


    I’m not sure I’m going about this the right way. Where do you go to see it laid out like you put in your last comment please? I use Dreamweaver if that helps.
     
  6. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,668
    Says you are looking at a Windows desktop computer NOT a Linux hosting server. .htaccess does NOT work on Windows and ONLY works in a HTTP context.
     
  7. jeanm

    jeanm Member

    Messages:
    150
    Many thanks Chris.
     

Share This Page