Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 8 of 8

This is a discussion on Custom 404 behavior in sub-domains in the Shared & Semi-Dedicated forum
Ever since I added a custom 404 page to my site a while back, I have been wondering something. When I type in the URL ...

  1. #1
    Aletia Customer
    Join Date
    Oct 2001
    Posts
    631

    Custom 404 behavior in sub-domains

    Ever since I added a custom 404 page to my site a while back, I have been wondering something. When I type in the URL to a non-existing page located in a sub-directory of my site, the custom 404 page loads correctly, but when that same file is refereced as being located in a sub-domain, rather than a sub-directory, it does not load the stylesheet, which is referenced by "/styles.css".

    http://bhq.joshuasplace.net/example.html
    http://joshuasplace.net/bhq/example.html

    My question is why? And, is there a way to fix this?

  2. #2
    JPC Guru
    Join Date
    Nov 2002
    Location
    Panama
    Posts
    305
    Did you try perhaps using your full url instead?

  3. #3
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    Your style sheet and images reside inside your public_html directory, and your page expects that to be the "base" of your request. When you access the page from the bhq subdomain, however, the base becomes public_html/bhq, and those files don't exist there.

    Apache uses the physical location of your error pages to load them, but anything that is linked to them is based on the http path, like a normal web page. In other words, when you set up the error page in .htaccess (or however you did it) you specified a path similar to /home/user/public_html/error.html. On the web, when you load an image at /images/pic.jpg, its not at /images/pic.jpg on the server, but rather /home/user/public_html/images/pic.jpg.

    So, to make the CSS and images work, you'll need to either copy them into the bhq directory, symbolicly link to them in there, or use the full URL to them on the "www" site.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  4. #4
    Aletia Customer
    Join Date
    Oct 2001
    Posts
    631
    How do I make a symlink?

  5. #5
    Jag Veteran
    Join Date
    Sep 2002
    Posts
    650
    ln -s <target> <link name>

    you can read more about ln command by typing
    man ln in your shell

  6. #6
    Aletia Customer
    Join Date
    Oct 2001
    Posts
    631
    When you say full URL, do you mean http://www.joshuasplace.net/images/ or home/user/public_html/images/

    What do you guys do to make your custom 404 pages work?

  7. #7
    Ron
    Guest
    Originally posted by Joshua Clinard
    When you say full URL, do you mean http://www.joshuasplace.net/images/
    That's a full URL (URI)

    Originally posted by Joshua Clinard
    or [home/user/public_html/images/
    That's a "fully qualified" file path

  8. #8
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    Think of it this way: the bhq site is a completely different website from your main site. bhq has no idea that the other exists and it cannot "see" the other site. Anything you reference in html, such as css, images, external JavaScript, Flash content, etc. is referenced by URL. Since bhq cannot see the public_html folder, it won't be able to load anything that's in it by url.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •