SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,617
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)

    What do you usually include in your .htaccess file?

    I've been finding myself starting to use some of the same htaccess splices over and over again, so I got wondering...what sort of things do you seem to reuse over a range of websites?

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    FF,

    Good question - and deserves a more thought-out answer but let me start with:

    ErrorDocument 404 {absolute URI/URL of error script}
    DirectoryIndex (to set the default page of the directories)
    Options -Indexes (to prevent listing of the directory's files)

    Since you're using .htaccess, prevent access to it!

    Sometimes, you may want to prevent image hijacking, bots, IP addresses/ranges, etc, but that all depends upon your level of paranoia (or known hacking attempts).

    Of course, there are always the "cutsie" things that the power of regex can do for you with mod_rewrite but that wasn't the question, was it?

    Anyone else with other always or optional COMMON uses?

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Forcing www (with R=301) can be useful for SEO purposes, to make sure links to some page go to a unique URL of that page whether or not the linking site used www or not

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    Dan has a good one ... but it's a funny one that's peculiar to individual webmasters: Force www or non-www (people go both ways - I tend toward getting rid of the www).

    You can also force the secure server to handle specific (or all) scripts whether it was requested by http(s) or not. IMHO, you do that AND include code at the top of your scripts.

    There are others, too, in my signature's tutorial article which include converting file extensions, removing file extensions, etc., but, while common, these are peculiar to individual needs/preferences.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


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
  •