skip to Main Content

My application is in Laravel + Vue I’v hosted on Hostinger VPS ubuntu 20.
when I type my site in Google like exptradies.com google showing all the directories as bellow image.
enter image description here

This is my site config

<VirtualHost *:80>
   ServerName exptradies.com
   ServerAlias www.exptradies.com
   ServerAdmin [email protected]
   DocumentRoot /var/www/html/exptradies/public

   <Directory /var/www/html/exptradies>
        AllowOverride All
        Options -Indexes
        Require all granted
        ReWriteEngine On
   </Directory>
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.exptradies.com [OR]
RewriteCond %{SERVER_NAME} =exptradies.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

This is the .htaccess file

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Does anyone know What I’m missing in the configuration.

for the ssl I use Letsencypt cerbot.

when I open the link I get this.
enter image description here

2

Answers


  1. Add public to your path in Directory and this probably will solve your problem

    <Directory /var/www/html/exptradies/public>
            AllowOverride All
            Options +FollowSymlinks
            Require all granted
            ReWriteEngine On
       </Directory>
    

    Don’t forget to restart apache service

    Login or Signup to reply.
  2. Your web server is configured to show directory indexes. That shows a web page with a list of files for directory requests when the directory does not contain an index document. You can disable this by using

    Options -Indexes
    

    That can either go beneath AllowOverride All or in your .htaccess file. If you make changes to your Apace configuration files, you will need to restart Apache or tell it to reload its conf files before they take effect.

    Another workaround is to create blank index.html files in each directory that is currently showing the file listing. Search engines will treat that as a "soft 404" error which will prevent it from getting indexed.

    After making changes, test that you can’t browse those directories and see the file listing anymore. Then you will have to wait a couple weeks for Googlebot to recrawl those pages and stop indexing them.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search