directory listimg

How do I disable directory listing?

Hello.

What do you exactly mean with ‘directory listing’ ?

If you’re talking about the file-index tree that gets displayed when visiting your website or certain folder, then that’s because you don’t have a index.php / index.html file in that directory so it instead renders that directory as file storage not as actual viewable webpage.

Yes, that’s the one. How do I fix This?

Simply create a file called .htaccess in your htdocs folder (or edit the one which is already there) and add the line: Options -Indexes

I’ve already tried that but it’s still not disabled

@Vasulho said:
I’ve already tried that but it’s still not disabled

No, there is no .htaccess file in your htdocs directory. There is one in the wp directory, but that .htaccess file only affects the content of the htdocs/wp/ folder and everything below it. You need to add the .htaccess file DIRECTLY to the htdocs folder.

How do i add that file? should i copy the file from the wordpress folder or should i create a new one?

You should definitely create a new one. The .htaccess file created by Wordpress contains settings for URLs for Wordpress too, and using it anywhere which isn’t Wordpress could lead to very weird issues.

How do i create one then?

The .htaccess file is a file called .htaccess. Use the file manager to create a new file and call it .htaccess. It’s not magic.

I’m new to this. So can you please create one for me

@Vasulho said:
I’m new to this. So can you please create one for me

Just go into the file manager, go to the htdocs directory, click the Create File button and enter the file name .htaccess. Doing it yourself would take less time than reading this message.

Sorry to teouble you again.
I’ve just created one but there seems to be error in the codes. Can you please find it out.

@Vasulho said:
Sorry to teouble you again.
I’ve just created one but there seems to be error in the codes. Can you please find it out.

No, I don’t know your codes so I don’t know what could be broken. Try to disable lines selectively to find out which lines cause the issue.

This is my code.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.Pikanyi.com\.com$ [NC]
RewriteRule ^(.)$ http://Pikanyi.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^.
/index.html
RewriteRule ^(.)index.html$ http://Pikanyi.com/$1 [R=301,L]
RewriteBase /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.
)$ $1.html
RewriteEngine On
RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1

compress text, HTML, JavaScript, CSS, and XML

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

remove browser bugs

BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

1 WEEK 1 DAY

<filesMatch “.(jpg|jpeg|png|gif|swf|ico)$”>
Header set Cache-Control “max-age=691200, public”

1 WEEK 1 DAY

<filesMatch “.(xml|txt|js)$”>
Header set Cache-Control “max-age=691200, proxy-revalidate”

1 WEEK 1 DAY

<filesMatch “.(html|htm|css|php)$”>
Header set Cache-Control “max-age=691200, private, proxy-revalidate”

Disable Directory Listing

Options - Indexes

I still can’t figure out where i went wrong. Please help me.

What I do see is Options - Indexes, which should be Options -Indexes (no space between the dash and the option). If that doesn’t solve it, you should really try to debug it yourself. Remove all the lines and then re-enable them one by one to see which line or lines are causing the problem.