VirtualHost config causing 301 redirect loop

Viewed 30

I am trying to setup a virtual server to host multiple websites,
each sites content is in /var/www/html/site.com/public_html

There have a VirtualHost config for each site under /etc/apache2/sites-avalible/site.com.conf as seen below:

/etc/apache2/sites-avalible/site1.com.conf

<VirtualHost *:443>
    DocumentRoot /var/www/html/site1.com/public_html
    ServerName site1.com
    <Directory /var/www/html/site1.com/public_html/>
        AllowOverride None
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /var/www/html/site1.com/public_html
    serverName site1.com

    <Directory /var/www/html/site1.com/public_html/>
      AllowOverride None
    </Directory>
</VirtualHost>

All this config is needing to do is direct the incomming domain request to its root direcotry, nothing else. however the moment I apply apply this config file it will cause a 301 redirect loop.

As you can see I have disabled AllowOverride to avoid interference from .htaccess to eliminate that variable, by enabling AllowOverride to all it also results in a redirect loop with no change in behavour. In case needed hear is the httpd.conf file thats not getting applied:

.htaccess

# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

I have also tried compleatly removing the .htaccess file to eliminate that variable and it still resulted in a redirect loop.

Additionally if I where to manually change the URL to point to a file in the site like /index.php or /wp-admin/ it will result in a 302 redrect loop to that same file or folder.

index.php also dose not refer back to itself but rather starts the wordpress program, and php.ini also dose not have any redirect config.

I cannot find where the redirects may be happening, some guidance on potential faults in the current config of what other files may be causeing redirects would be much appreciated.

0 Answers
Related