Score:0

Apache 320 redirect loop with correct htaccess and virtualhost conf

me flag

I am web designer and I manage a VPS Server.

Server is LAMP Ubuntu 18 apache2 PHP 7.4 root index.html

This page isn’t working test.com redirected you too many times. Try clearing your cookies. ERR_TOO_MANY_REDIRECTS

Have checked the .htaccess and vhost conf could not find anything wrong

   Status:  302 Found
   Code:    302
   Date:    Mon, 21 Aug 2023 06:07:02 GMT
   Server:  Apache/2.4.29 (Ubuntu)
   Location:    https://test.com
   Content-Length:  301
   Connection:  close
   Content-Type:    text/html; charset=iso-8859-1```

htaccess file :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
   vhost file
   <VirtualHost *:80>
    ServerName www.test.com
    ServerAlias test.com
    DocumentRoot /var/www/test.com
    Redirect "/" "https://www.test.com"
   </VirtualHost>

tsc_chazz avatar
vn flag
Please include both the .htaccess and the vhost.conf in your question.
tsc_chazz avatar
vn flag
Is there a vhost file for the port 443 (HTTPS:) as well?
SACHIN HD avatar
me flag
no have same vhost for other working websites, they are fine. @ tsc_chazz
HBruijn avatar
in flag
Additionally: Ubuntu 18 is End of Life unless you have paid extended support - https://ubuntu.com/18-04
SACHIN HD avatar
me flag
Fixed it. It was in the 443 block of vhost -le-ssl.conf in sites-available @HBruijn
Score:0
in flag

You only posted the VirtualHost block for the plain HTTP port, port 80.

There should be a second VirtualHost block (possibly from a different sites-available Include file) for the HTTPS VirtualHost on port 443.

In there you have a redirect from https://example.com to https://example.com (which results in an endless loop).

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.