Announcement

Collapse
No announcement yet.

Custom Error Page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Error Page

    Hi,

    I have a query regarding the content in the directory of website. I have a website which has certain directories with some html pages and files in it, While opening a page or file, it will show the link like "www.my-domain-name.com/FOLDER/pagename.html or "www.my-domain-name.com/FOLDER/filename.txt" but when someone would try to open the folder in a browser to view the contents in the directory like (http://www.my-domain-name.com/FOLDER/"), I would want him to see a 404 error, PAGE NOT FOUND Error.

    Now My Question is

    1) Is it possible to do this ?
    2) If Yes, then should I redirected the folder root to the Custom Error Page or something ???? Or there is some other way of doing that,,, ???
    2) Also Is that way a proper way for securing the content in the directories ?

  • #2
    Turning of indexing will prevent them from seeing files listed in that folder.

    Comment


    • #3
      Does that mean that placing an index file will prevent them to view the files listed in the directory ?

      Yes I know that if I place an index file in the folder it will prevent the listing of files, but Im curious to know that is there any other way to prevent the users from seeing the files in the folder without placing the Index file in the folder. As i have seen some sites which dont allow to view the files in the folder and they get redirected when I tried to open the folder to view the files in it.

      E.g.: if i try to open "http://www.domain-name.com/FOLDER_NAME/" it will redirect me to "http://www.domain-name.com" or some other part of the site.

      Comment


      • #4
        You can turn of indexing for any folder from cpanel (index manager), this will create a .htaccess file that would stop anyone seeing in that folder.
        If you want to redirect anyone who goes to that url you can create a .htaccess file and put a redirect rule in it that sends them back to your main domain.

        If you have cpanel just go to the redirect section and fill in what you want to redirect and it will create a .htaccess file for you.

        Comment


        • #5
          If you want to redirect to a custom error page, you could create a .htaccess and put something like

          Options All -Indexes
          errorDocument 403 /forbidden.html

          Then create your forbidden.html file and put it in your root.

          Comment


          • #6
            Redirect 403, 404 error pages to the custom error pages using .htaccess rule

            There are certain Steps which are discussed below:

            Create your own customized error pages for 404 or 403 or any other error type. You can create it with your own logo and content.
            Create the .htaccess file in the root virtual directory and write the following code in the .htaccess file.
            ErrorDocument 404 404.html

            ErrorDocument 403 403.html

            If you want to show your index page, if any of the 404 or 403 error occurs. Then write the following line in your htaccess file.

            ErrorDocument 404 index.html

            ErrorDocument 403 index.html

            Eliza

            Comment


            • #7
              Hi,

              I have a query regarding the content in the directory of website. I have a website which has certain directories with some html pages and files in it, While opening a page or file, it will show the link like "www.my-domain-name.com/FOLDER/pagename.html or "www.my-domain-name.com/FOLDER/filename.txt" but when someone would try to open the folder in a browser to view the contents in the directory like (http://www.my-domain-name.com/FOLDER/"), I would want him to see a 404 error, PAGE NOT FOUND Error.

              Now My Question is

              1) Is it possible to do this ?
              2) If Yes, then should I redirected the folder root to the Custom Error Page or something ???? Or there is some other way of doing that,,, ???
              2) Also Is that way a proper way for securing the content in the directories ?

              Itís
              Options -Indexes
              to turn off files listing in folder.
              And
              Options Indexes
              to turn on files listing in folder.
              Make sure you have to put these rules in .htaccess file.

              Comment

              Working...
              X