-1

I'm using Apache2, and I'm still pretty new to it.

The issue I'm having is my site, is causing infinite loops, and I also want to get rid of the WWW portion from my domains and subdomains.

This is my conf file for port 80:

<VirtualHost *:80>
    ServerName foo.example.com
    ServerAlias www.foo.example.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/foo/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =foo.example.ga
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI}
</VirtualHost>

This is my conf file for port 443:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/foo/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName foo.example.com
ServerAlias www.foo.example.com
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/foo.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/foo.example.com/privkey.pem
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.foo.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
</IfModule>

Now I know that it isn't coded properly, but if someone could point me towards the right direction, that'd be wonderful. Thank you!

c0ry
  • 1
  • 1

1 Answers1

0

To my rookie mistake, I didn't check the .htaccess that was in the specified directory. I deleted the content (I like having the web info in one place) and put the rewrite rules in my configuration file.

c0ry
  • 1
  • 1