如何让apache从克隆到EC2示例的github repo文件夹中加载索引文件?

lstz6jyr  于 2022-12-14  发布在  Apache
关注(0)|答案(1)|浏览(121)

我已经在EC2示例上安装了apache,但无法配置我的.htacess以重定向到位于文件夹中的索引文件。
这就是我所拥有的:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^[domain name] [NC,OR]
RewriteCond %{HTTP_HOST} ^[domain name]
RewriteCond %{REQUEST_URI} ![repository folder]/
RewriteRule ^(.*)$ /[repository folder]/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html`

我尝试将位于repository文件夹中的index.html文件用作索引页。

rfbsl7qr

rfbsl7qr1#

如果您将Apache文档根目录配置为存储库文件夹,则不需要重定向。请确保将默认索引文件设置为index.html(可能是默认值)。

<VirtualHost *:80>
   DocumentRoot "/home/git/public_html/my_repo_name"
   ServerName www.mydomain.com
   DirectoryIndex index.html
</VirtualHost>

相关问题