WordPress Website Shows List of Files in Directory

htaccess wordpress

Is your WordPress website not showing up on the web pages and rather it’s displaying the list of files from the directory of your web server? This could be a nightmare for WordPress designers, especially for newbies.

In this blog post, I am going to share how you can fix this problem. Usually, when you see the list of files on the browser while trying to open up your WordPress website, it could be an issue with the .htaccess file on your server.

Either the .htaccess file is misconfigured or there is no .htaccess file on your web server at all. If you face such a situation, then you must try to update your existing .htaccess file or create a new .htaccess file (if it’s missing on your web server) and make sure to have the below lines of scripts.

[cc]RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ – [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule. index.php [L]
DirectoryIndex index.php[/cc]