기본 URL을 애플리케이션 디렉토리로 리디렉션

기본 URL을 애플리케이션 디렉토리로 리디렉션

AWS 서버가 있습니다. Laravel 프로젝트를 설정했는데 잘 작동합니다. 프로젝트는 /var/www/MyProject 아래에 있으며 myproject.com/public으로 이동하면 애플리케이션이 표시됩니다(Apache 사용자 이름과 비밀번호를 입력한 후).

그러나 기본 URL인 myproject.com으로 이동하면 Apache 테스트 페이지가 표시됩니다. 이 페이지를 보고 싶지 않습니다. 기본 URL로 이동하면 애플리케이션으로 직접 리디렉션하고 싶습니다. 스플래시 페이지를 제거하는 Apache Welcome.conf 파일의 모든 텍스트를 커밋했지만 대신 액세스 금지 메시지가 표시됩니다.

내 가상 호스트는 다음과 같습니다.

# 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>

답변1

나는 그것을 알아.

/etc/httpd/conf.d/welcome.conf를 열고 웹사이트에 대한 영구 리디렉션을 추가합니다.

<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

관련 정보