how would you do this (preferably using .htaccess)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AssFairy
    Confirmed User
    • Jun 2003
    • 674

    #1

    how would you do this (preferably using .htaccess)

    How would you set a directory so that a call to

    somedomain.com/somedirectory/index.html
    would load the index.html but a call to

    somedomain.com/somedirectory/
    could be redirected because they didn't include the index.html

    Can this be done?
    I sale lube
  • xenophobic
    Confirmed User
    • Mar 2004
    • 874

    #2
    are you wanting to stop showing a directory listing?
    in .htaccess you just place
    Options -Indexes

    if that's the case, if not look @ mod_rew\rite, I'm not sure I understand the question, so can't tell much more than that.

    Comment

    • AssFairy
      Confirmed User
      • Jun 2003
      • 674

      #3
      Originally posted by xenophobic
      are you wanting to stop showing a directory listing?
      in .htaccess you just place
      Options -Indexes

      if that's the case, if not look @ mod_rew\rite, I'm not sure I understand the question, so can't tell much more than that.
      No I don't want them to see the directory I want to be able to redirect them to another url.

      Problem is that if you don't request a file name in the URL it looks for an index file , if it finds one it doesn't generate a 303 or 404 error.

      Just wondering if there's a way round it.
      I sale lube

      Comment

      • boldy
        Macdaddy coder
        • Feb 2002
        • 2806

        #4
        RehahahahahaEngine on
        RehahahahahaRule ^/$ /some/where/else [R]

        ?

        *edit* hahahahaha = w r i t e without the spacing ..
        MacDaddy Coder.

        Comment

        • AssFairy
          Confirmed User
          • Jun 2003
          • 674

          #5
          Originally posted by boldy
          RehahahahahaEngine on
          RehahahahahaRule ^/$ /some/where/else [R]

          ?

          *edit* hahahahaha = w r i t e without the spacing ..
          Nope, I just tried it and its still loading the index.html
          I sale lube

          Comment

          • boldy
            Macdaddy coder
            • Feb 2002
            • 2806

            #6
            Add

            DirectoryIndex notfound.html

            or something ...
            MacDaddy Coder.

            Comment

            • boldy
              Macdaddy coder
              • Feb 2002
              • 2806

              #7
              if it doesnt work read : http://httpd.apache.org/docs/misc/re...hahaguide.html

              *edit* nice banned words Lens
              MacDaddy Coder.

              Comment

              • AssFairy
                Confirmed User
                • Jun 2003
                • 674

                #8
                Originally posted by boldy
                if it doesnt work read : http://httpd.apache.org/docs/misc/re...hahaguide.html

                *edit* nice banned words Lens
                dayum that page would take me a week to digest

                maybe there's a way to use .htaccess to tell the server NOT to look for an index page and therefore generate a 404 error when an open directory is called?
                I sale lube

                Comment

                • Serge Litehead
                  Confirmed User
                  • Dec 2002
                  • 5190

                  #9
                  in your httpd.conf you set
                  DirectoryIndex index.html index.htm index.php index.cgi index.pl default.htm default.html
                  apache loads whichever finds first in the order you have
                  so you need to remove index.html from DirectoryIndex, this directive also works from htaccess file, after you remove index.html, set ErrorDocumen</b>t 404 /404.html or index
                  in your htaccess

                  Comment

                  Working...