SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2007
    0 Post(s)
    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 the 404 page looks how I want. But, if I go to any subdirectory (, 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.


  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Northeastern USA
    56 Post(s)
    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:
    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
    Whiteford, Maryland, United States
    11 Post(s)
    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.

  4. #4
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    The Netherlands
    153 Post(s)
    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.

    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


Posting Permissions

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