Score:0

Redirect Base URL to Application Directory

ph flag

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 [email protected]
    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>
Score:0
ph flag

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
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.