SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2007
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS or .htaccess

    Forgive me if this is the wrong place to ask, but I'm wondering how I would ensure my 404 page is formatted the same for every directory. I thought I could figure this out, but I cannot.

    My problem is when I test my 404 page and go to mydomain.com/pagethatdoesnotexist the 404 page looks how I want. But, if I go to any subdirectory (mydomain.com/articles/pagethatdoesnotexist), the footer text is a different font and smaller size.

    I thought it would be fixable via either CSS or .htaccess, but there's no css file in the root, and there are various .htaccess files all over in subdirectories for wordpress installs and other stuff. Yes, I've got quite a mess here.

    Is there anything I can put in one (or all) .htaccess file(s) that would ensure my 404 page looks like it does from the root directory, AND not mess with any other necessary settings in those .htaccess files?

    I appreciate your thoughts in advance.

    Thanks,
    Myles

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,615
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    A quick fix would be to embed the CSS in the html in <style> tags. However, that might not always be appropriate/possible depending on how your website is set up.

    Another option is using the base tag in your HTML: http://www.w3schools.com/tags/tag_base.asp
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,711
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Depending on your host you can design your 404's (I know bluehost makes this easy)

    I don't know how 404's work (how the host generates the page for them, like, ..I don't know how to explain)

    If some other user has better knoweldge of 404 then they can come here..but I'd imagine just using an absolute reference to the stylesheet would provide the smae styling (assuming the HTML is the same)
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  4. #4
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,094
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by RyanReese View Post
    I'd imagine just using an absolute reference to the stylesheet would provide the smae styling (assuming the HTML is the same)
    Spot on

    As for the 404 HTML pages, you'd need to look at the .htaccess ErrorDocument lines
    All .htaccess files should point to the same html file for the 404 error.

    e.g.
    Code:
    ErrorDocument 404 /404.html
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy


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
  •