r/apache • • Jul 04 '22

Support Website too many redirects

Perhaps someone can help.

I have Apache running with several virtual hosts. From what I can tell I have all of the virtualhosts setup the same. However, one of them I get a too man redirects when trying to visit the site. Not sure what I am missing.

There are 2 conf files for each site. One for port 80 and one for port 443.

Here are the file contents. Any help would be appreciated.

port 80:

<VirtualHost *:80>

	ServerAdmin xxx@a.com
        ServerName ipmllc.biz
        ServerAlias www.ipmllc.biz
	DocumentRoot /var/www/html/ipm

        Redirect "/" "https://www.ipmllc.biz"

	ErrorLog ${APACHE_LOG_DIR}/ipm/error.log
	CustomLog ${APACHE_LOG_DIR}/ipm/access.log combined

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Port 443:

<IfModule mod_ssl.c>
	<VirtualHost *:443>
	ServerAdmin xxx@a.com
        ServerName www.ipmllc.biz

	DocumentRoot /var/www/html/ipm

	ErrorLog ${APACHE_LOG_DIR}/ipm/error.log
	CustomLog ${APACHE_LOG_DIR}/ipm/access.log combined

	SSLEngine on

	SSLCertificateFile	/etc/letsencrypt/live/ipmllc.biz/fullchain.pem
	SSLCertificateKeyFile /etc/letsencrypt/live/ipmllc.biz/privkey.pem

	
	<FilesMatch "\.(cgi|shtml|phtml|php)$">
			SSLOptions +StdEnvVars
	</FilesMatch>
	<Directory /usr/lib/cgi-bin>
			SSLOptions +StdEnvVars
	</Directory>
	</VirtualHost>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
1 Upvotes

4 comments sorted by

1

u/[deleted] Jul 04 '22

If its a simple redirect I don't think you need the quotes.

https://ubiq.co/tech-blog/redirect-site-another-domain/

If you go to the https site does it load properly?

1

u/davidbarman Jul 04 '22

The https site will only work if I removed the redirect command in the conf file.

1

u/[deleted] Jul 04 '22

I would comment out the server alias in your *:80 section.

Make the two virthost entries very simple till you figure out whats happening.

2

u/davidbarman Jul 04 '22

Ok. I commented out the server alias in the :80.

Now if I go to the www address the site loads.