0

I have an AWS server. I set up a Laravel project, and it's working fine. The project is under /var/www/MyProject, and when I go to myproject.com/public, I see the application (after entering my apache username and password).

However, when I go to just the base URL, myproject.com, I see the Apache test page. I don't want to see this page. When I go to the base URL, I just want to redirect directly to the application. I commited out all of the text in the Apache welcome.conf file, which removes the splash page, but I get an access forbidden message instead.

Here's my vhost:

# Laravel 8 base install test
<VirtualHost *:80>
    ServerAdmin root@myproject.com
    DocumentRoot "/var/www/myproject"
    ServerName myproject.com
    <Directory "/var/www/myproject/public">
        Options Indexes FollowSymLinks
        #DirectoryIndex index.php
        AllowOverride All
        AuthBasicProvider file
        AuthUserFile /etc/httpd/conf.d/.htpasswd
        AuthType Basic
        AuthName "Auth"
        Require valid-user
    </Directory>
    # Protect development directories from prying eyes.
    RewriteEngine On
    RewriteRule (^|/)docs(/|$) - [F]
    RewriteRule (^|/)node_modules(/|$) - [F]
    #RewriteRule (^|/)vendor(/|$) - [F]
</VirtualHost>

1 Answers1

0

I figured it out.

Open to /etc/httpd/conf.d/welcome.conf and add a permanent redirect to website:

<LocationMatch "^/+$">
    Redirect permanent / https://myproject.com  #Added this line
    Options -Indexes
    ErrorDocument 403 /.noindex.html
</LocationMatch>

<Directory /usr/share/httpd/noindex>
    AllowOverride None
    Require all granted
</Directory>

Alias /.noindex.html /usr/share/httpd/noindex/index.html