Home > Software engineering >  How do I get apache to load an index file inside a folder from a github repo that is cloned into my
How do I get apache to load an index file inside a folder from a github repo that is cloned into my

Time:12-08

I've installed apache on my EC2 instance but can't configure my .htacess to redirect to an index file located inside a folder.

This is what I have:

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`

I was trying to have the index.html file that's located in the repository folder to be used as the index page.

CodePudding user response:

If you configure your Apache document root to be the repository folder, no redirect is needed. Be sure to set your default index file to be index.html (probably the default).

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