0

I have create a sub domain like images.domain.com. accessing it via browser it is listing the content at sub domain.

like

    Index of /

   content1/
   content2/
    content3/

I dont want to show the content of sub domain.

How to achieve this?

3

You seem to have directory Indexes enabled (Apache automatically creates a directory listing in such cases). You can workaround this by either placing an empty index.html file in the document root of the subdomain (assuming index.html is a registered index document).

Or, disable directory Indexes in your .htaccess file (in the document root of your subdomain, or even in the document root of your main domain, depending on your file system structure.):

Options -Indexes

Reference: Apache Docs - Options Directive:

Indexes
If a URL which maps to a directory is requested and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will return a formatted listing of the directory.

  • in my subdomain there is no .htaccess file available. It is available in main domain – Manish Aug 3 '15 at 10:31
  • There is no .htaccess file by default, you need to create it. However, if the main domain points to the parent folder, then you can probably use that (providing you are not relying on this Apache feature on your main site). .htaccess directives in parent folders are inherited. This directive should go at the top. – MrWhite Aug 3 '15 at 10:34
  • I want to creat it in subdomain and should i put only Options -Indexes to not showing the content – Manish Aug 3 '15 at 10:35
  • Yes, that is correct. – MrWhite Aug 3 '15 at 10:37
  • Yes it is not shoing content. It also protect my images/contents from showing search engines?? – Manish Aug 3 '15 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.