1

I have Mint 19.1; Apache 2.4; PHP 7.2; phpmyadmin, Wordpress 5.1.1 successfully installed and functioning.

  • Site 1 Works as expected
  • Site 2 Redirects to Site 1 without warning
  • Site 3 Works as expected

The ONLY thing that appears to be different about Site 2, is that the TLD is .US vs .com

  • I have site1.com in /var/www/site1.com/html
  • I have site2.us in /var/www/site2.us/html
  • I have site3.com in /var/www/site3.com/html

I have /etc/apache2/sites-available/ site1.conf, site2.conf and site3.conf files and those migrate to /etc/apache2/sites-enabled/ when I use A2ensite to enable each of the site conf files. I intend to migrate these to HTTPS once this is resolved.

Edit showing .conf files

Site 1

<VirtualHost *:80>  
   ServerName site1.com  
   Redirect permanent / https://site1.com/  
</VirtualHost>  

<VirtualHost *:443>  
        Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"  
        Header always append X-Frame-Options SAMEORIGIN  
        Header set X-XSS-Protection "1; mode=block"  
        ServerAdmin aranthorne@gmail.com  
        ServerName site1.com  
        ServerAlias www.site1.com  
        DocumentRoot /var/www/site1.com/html  
        ErrorLog ${APACHE_LOG_DIR}/error.log  
        CustomLog ${APACHE_LOG_DIR}/access.log combined  
        SSLEngine on  
        SSLCertificateFile  /etc/apache2/ssl/site1.com.crt  
        SSLCertificateKeyFile /etc/apache2/ssl/site1.com.key  
        SSLCertificateChainFile /etc/apache2/ssl/site1.com.intermediate.crt  
        SSLCipherSuite HIGH:!MEDIUM:!aNULL:!MD5:!RC4  
        SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire  
        <FilesMatch "\.(cgi|shtml|phtml|php)$">  
                SSLOptions +StdEnvVars  
        </FilesMatch>  
        <Directory /usr/lib/cgi-bin>  
                SSLOptions +StdEnvVars  
        </Directory>  
        <Directory /var/www/site1.com/html/>  
                AllowOverride All  
        </Directory>  
        RewriteEngine On  
        RewriteCond %{THE_REQUEST} !HTTP/1.1$  
        RewriteRule .* - [F]  
        ServerSignature Off  

</VirtualHost>  

Site2

<VirtualHost *:80>  
   ServerName site2.us  
   Redirect permanent / https://site2.us/  
</VirtualHost>  

<VirtualHost *:443>  
        Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"  
        Header always append X-Frame-Options SAMEORIGIN  
        Header set X-XSS-Protection "1; mode=block"  
        ServerAdmin aranthorne@gmail.com  
        ServerName site2.us  
        ServerAlias www.site2.us  
        DocumentRoot /var/www/site2.us/html  
    ErrorLog ${APACHE_LOG_DIR}/error.log  
    CustomLog ${APACHE_LOG_DIR}/access.log combined  
    SSLEngine on  
    SSLCertificateFile  /etc/apache2/ssl/site2.us.crt  
    SSLCertificateKeyFile /etc/apache2/ssl/site2.us.key  
    SSLCertificateChainFile /etc/apache2/ssl/site2.us.intermediate.crt  
    SSLCipherSuite HIGH:!MEDIUM:!aNULL:!MD5:!RC4  
    SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire  
    <FilesMatch "\.(cgi|shtml|phtml|php)$">  
            SSLOptions +StdEnvVars  
    </FilesMatch>  
    <Directory /usr/lib/cgi-bin>  
            SSLOptions +StdEnvVars  
    </Directory>  
    <Directory /var/www/site2.us/html/>  
            AllowOverride All  
    </Directory>  
        RewriteEngine On  
        RewriteCond %{THE_REQUEST} !HTTP/1.1$  
        RewriteRule .* - [F]  
        ServerSignature Off  

</VirtualHost>  

Site3

<VirtualHost *:80>  
   ServerName site3.com  
   Redirect permanent / https://site3.com/  
</VirtualHost>  

<VirtualHost *:443>  
        Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"  
        Header always append X-Frame-Options SAMEORIGIN  
        Header set X-XSS-Protection "1; mode=block"  
        ServerAdmin aranthorne@gmail.com  
        ServerName site3.com  
        ServerAlias www.site3.com  
        DocumentRoot /var/www/site3.com/html  
        ErrorLog ${APACHE_LOG_DIR}/error.log  
        CustomLog ${APACHE_LOG_DIR}/access.log combined  
        SSLEngine on  
        SSLCertificateFile  /etc/apache2/ssl/site3.com.crt  
        SSLCertificateKeyFile /etc/apache2/ssl/site3.com.key  
        SSLCertificateChainFile /etc/apache2/ssl/site3.com.intermediate.crt  
        SSLCipherSuite HIGH:!MEDIUM:!aNULL:!MD5:!RC4  
        SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire  
        <FilesMatch "\.(cgi|shtml|phtml|php)$">  
                SSLOptions +StdEnvVars  
        </FilesMatch>  
        <Directory /usr/lib/cgi-bin>  
                SSLOptions +StdEnvVars  
        </Directory>  
        <Directory /var/www/site3.com/html/>  
                AllowOverride All  
        </Directory>  
        RewriteEngine On  
        RewriteCond %{THE_REQUEST} !HTTP/1.1$  
        RewriteRule .* - [F]  
        ServerSignature Off  

</VirtualHost>  

** /var/www/site2.us/html/.htacess **

# BEGIN WordPress  
<IfModule mod_rewrite.c>  
RewriteEngine On  
RewriteBase /  
RewriteRule ^index\.php$ - [L]  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteRule . /index.php [L]  
</IfModule>  
  • 1
    Suggest you edit your posts to share the configurations if you want help finding and fixing the errors. – Tim Mar 17 at 7:07
  • Thanks Tim, updated the question with the .conf files. – Aranthorne Mar 18 at 8:56
  • Do you have any .htaccess files under /var/www/site2.us/html? Do you have any log entries from the times the redirect happened? – Jenny D Mar 18 at 9:32
0

After clearing and rebooting the router and the cable modem, this odd behavior was eliminated. I presume the router was caching something incorrectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.