Jump to content

[SOLVED] ERR_TOO_MANY_REDIRECTS - Moved site from nginx to apache


Thbor83

Recommended Posts

After moving the site to apache from nginx the ERR_TOO_MANY_REDIRECTS is not going away.

The problem started on the old server when removing the multistore setup and just leaving the one store be active.

From some suggestion I moved to new server with Apache, and moved DB and files over to this server.
Backend works as it shall, but frontend for store is giving error.

I have tried to remove .htaccess content and rebuild it, deleted cache in /var/cache
What i find weird is that I have changed in "Traffic & SEO" to 301 redirect, but still even in incognito it still shows 302 redirect

Have read through the forum posts about this problem and for backend I have gotten it fixed when this problem occurs, but not for store frontend, there it seems to not work with any suggestion

If I install new prestashop on same server it works both for frontend and backend, so something wrong with old configuration on the old store I have moved. Any suggestion?

Edited by Thbor83 (see edit history)
Link to comment
Share on other sites

8 hours ago, Thbor83 said:

After moving the site to apache from nginx the ERR_TOO_MANY_REDIRECTS is not going away.

The problem started on the old server when removing the multistore setup and just leaving the one store be active.

From some suggestion I moved to new server with Apache, and moved DB and files over to this server.
Backend works as it shall, but frontend for store is giving error.

I have tried to remove .htaccess content and rebuild it, deleted cache in /var/cache
What i find weird is that I have changed in "Traffic & SEO" to 301 redirect, but still even in incognito it still shows 302 redirect

Have read through the forum posts about this problem and for backend I have gotten it fixed when this problem occurs, but not for store frontend, there it seems to not work with any suggestion

If I install new prestashop on same server it works both for frontend and backend, so something wrong with old configuration on the old store I have moved. Any suggestion?

It’s almost always leftover multistore URLs or SSL/canonical settings.

Check and fix ps_shop_url (domain, domain_ssl, / base, no virtual_uri), regenerate .htaccess, clear var/cache, and ensure only one HTTPS/www redirect rule without conflict.

  • Like 1
Link to comment
Share on other sites

On 8/15/2025 at 2:59 PM, Mehdi Bourechka said:

It’s almost always leftover multistore URLs or SSL/canonical settings.

Check and fix ps_shop_url (domain, domain_ssl, / base, no virtual_uri), regenerate .htaccess, clear var/cache, and ensure only one HTTPS/www redirect rule without conflict.

Thanks for the suggestions, I already done this things and it did not help

Checked also in DB that url er correct, regenerated .htaccess, removed data in cache folders.

Link to comment
Share on other sites

Here are my .htaccess file. do anyone see something I do not see? Must be a file or something having any line that makes it redirect and go in loop

 

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# https://www.prestashop.com - https://www.prestashop.com/forums

<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>

RewriteEngine on


#Domain: shop.com
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api(?:/(.*))?$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
RewriteRule ^upload/.+$ %{ENV:REWRITEBASE}index.php [QSA,L]

# Images
RewriteCond %{HTTP_HOST} ^shop.com$
RewriteRule ^(([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$1$3 [L]
RewriteCond %{HTTP_HOST} ^shop.com$
RewriteRule ^(([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$1$4 [L]
RewriteCond %{HTTP_HOST} ^shop.com$
RewriteRule ^(([\d])([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$4/$1$5 [L]
RewriteCond %{HTTP_HOST} ^shop.com$
RewriteRule ^(([\d])([\d])([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$4/$5/$1$6 [L]
RewriteCond %{HTTP_HOST} ^shop.com$
RewriteRule ^(([\d])([\d])([\d])([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$4/$5/$6/$1$7 [L]
RewriteCond %{HTTP_HOST} ^shop.com$
RewriteRule ^(([\d])([\d])([\d])([\d])([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$4/$5/$6/$7/$1$8 [L]
RewriteCond %{HTTP_HOST} ^shop.com$
RewriteRule ^(([\d])([\d])([\d])([\d])([\d])([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$4/$5/$6/$7/$8/$1$9 [L]
RewriteCond %{HTTP_HOST} ^shop.com$
RewriteRule ^c/([\d]+)(\-[\.*\w-]*)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/c/$1$2$3 [L]
RewriteCond %{HTTP_HOST} ^shop.com$
RewriteRule ^c/([a-zA-Z_-]+)(-[\d]+)?/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/c/$1$2$3 [L]
# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ %{ENV:REWRITEBASE}js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/font-woff .woff
AddType font/woff2 .woff2
<IfModule mod_headers.c>
        <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">
                Header set Access-Control-Allow-Origin "*"
        </FilesMatch>
</IfModule>

<Files composer.lock>
    # Apache 2.2
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>

    # Apache 2.4
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
</Files>
#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

 

Link to comment
Share on other sites

my two cents on this Sunday morning

I’ve seen this exact loop when ps_shop_url.domain or ps_shop_url.domain_ssl contains a protocol (e.g., https://example.com). Those fields must be hostnames only—no http://, no https://, no trailing slash.

Link to comment
Share on other sites

Thanks el patron, but both are without trailing slash and http:// or https://

 

Only domain name in both of them, like shop.com

1 hour ago, El Patron said:

my two cents on this Sunday morning

I’ve seen this exact loop when ps_shop_url.domain or ps_shop_url.domain_ssl contains a protocol (e.g., https://example.com). Those fields must be hostnames only—no http://, no https://, no trailing slash.

 

  • Like 1
Link to comment
Share on other sites

5 hours ago, Thbor83 said:

Thanks el patron, but both are without trailing slash and http:// or https://

 

Only domain name in both of them, like shop.com

 

sorry that did not help, it's difficult in forum we have to ask 20 questions.  what is your hosting provider?  can you post up screen shots of your php and hosting parms?   (hopefully it's plesk :))

 

here is working apache .htaccess from client shop

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# https://www.prestashop.com - https://www.prestashop.com/forums

<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>

RewriteEngine on


#Domain: yourdomain.com
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api(?:/(.*))?$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
RewriteRule ^upload/.+$ %{ENV:REWRITEBASE}index.php [QSA,L]

# Images
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule ^(([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$1$3 [L]
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule ^(([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$1$4 [L]
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule ^(([\d])([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$4/$1$5 [L]
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule ^(([\d])([\d])([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$4/$5/$1$6 [L]
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule ^(([\d])([\d])([\d])([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$4/$5/$6/$1$7 [L]
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule ^(([\d])([\d])([\d])([\d])([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$4/$5/$6/$7/$1$8 [L]
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule ^(([\d])([\d])([\d])([\d])([\d])([\d])([\d])(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/$2/$3/$4/$5/$6/$7/$8/$1$9 [L]
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule ^c/([\d]+)(\-[\.*\w-]*)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/c/$1$2$3 [L]
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule ^c/([a-zA-Z_-]+)(-[\d]+)?/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/c/$1$2$3 [L]
# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ %{ENV:REWRITEBASE}js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/font-woff .woff
AddType font/woff2 .woff2
<IfModule mod_headers.c>
	<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">
		Header set Access-Control-Allow-Origin "*"
	</FilesMatch>
</IfModule>

<Files composer.lock>
    # Apache 2.2
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>

    # Apache 2.4
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
</Files>
<IfModule mod_expires.c>
	ExpiresActive On
    AddType image/webp .webp
    ExpiresByType image/webp "access plus 1 month"
    ExpiresByType image/avif "access plus 1 month"
	ExpiresByType image/gif "access plus 1 month"
	ExpiresByType image/jpeg "access plus 1 month"
	ExpiresByType image/png "access plus 1 month"
	ExpiresByType text/css "access plus 1 week"
	ExpiresByType text/javascript "access plus 1 week"
	ExpiresByType application/javascript "access plus 1 week"
	ExpiresByType application/x-javascript "access plus 1 week"
	ExpiresByType image/x-icon "access plus 1 year"
	ExpiresByType image/svg+xml "access plus 1 year"
	ExpiresByType image/vnd.microsoft.icon "access plus 1 year"
	ExpiresByType application/font-woff "access plus 1 year"
	ExpiresByType application/x-font-woff "access plus 1 year"
	ExpiresByType font/woff2 "access plus 1 year"
	ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
	ExpiresByType font/opentype "access plus 1 year"
	ExpiresByType font/ttf "access plus 1 year"
	ExpiresByType font/otf "access plus 1 year"
	ExpiresByType application/x-font-ttf "access plus 1 year"
	ExpiresByType application/x-font-otf "access plus 1 year"
</IfModule>

<IfModule mod_headers.c>
    Header unset Etag
</IfModule>
FileETag none
<IfModule mod_deflate.c>
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript font/ttf application/x-font-ttf font/otf application/x-font-otf font/opentype image/svg+xml
    </IfModule>
</IfModule>

#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

 

Link to comment
Share on other sites

Understandable, it is not always easy to know all the answers :)

I host the server myself, it is not plesk, it is a ubuntu 22.04 with apache
What settings do you want screenshot of?

I tried the htaccess file you provided, it did not help. it still gives ERR_TO_MANY_REDIRECTS :(

Link to comment
Share on other sites

45 minutes ago, Thbor83 said:

Understandable, it is not always easy to know all the answers :)

I host the server myself, it is not plesk, it is a ubuntu 22.04 with apache
What settings do you want screenshot of?

I tried the htaccess file you provided, it did not help. it still gives ERR_TO_MANY_REDIRECTS :(

I probably know all the answers but when you post initially it's best to give us all the informatoins, ps version, php version, operating system, control panel name if any, things you would need to know to solve.

ok here is guess 2 or 3, I have like 18 more jajajaja

Case A: force non-www + https

<IfModule mod_rewrite.c>
RewriteEngine On

# Redirect www → non-www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]

# Redirect http → https
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>


Case B: force www + https

<IfModule mod_rewrite.c>
RewriteEngine On

# Redirect non-www → www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# Redirect http → https
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

Notes

  • Put this at the very top of .htaccess, above PrestaShop’s own generated rules (# ~~start~~ section).
  • Only pick one of the two cases (A or B). Don’t mix them.
  • If you already have redirects in your Apache <VirtualHost> for :80, don’t duplicate them in .htaccess — keep the logic in one place.
  • After changes: clear PrestaShop cache (var/cache/*) and test with:

curl -I http://example.com
curl -I http://www.example.com
curl -I https://example.com
curl -I https://www.example.com
 

Link to comment
Share on other sites

That is true, more information, the better it is for you guys, sorry if I have left something out.

But tried your suggestions, I do not use www. so only took shop.com
Case A

curl -I http://broditshop.no
HTTP/1.1 301 Moved Permanently
Date: Mon, 18 Aug 2025 05:16:01 GMT
Server: Apache/2.4.58 (Ubuntu)
Location: https://broditshop.no/
Content-Type: text/html; charset=iso-8859-1

curl -I https://broditshop.no
HTTP/2 302
set-cookie: PrestaShop-90e51997b8be74dcc470a0950789a219=def502007c23453c7eb8030c0ea9f6dac0c4662c9d86f915d2aec64fc80bdbf565b85913261c5c7ce4997c9b1e45974f63be0cfad91e594aee340d132b1cf2c5ff9ee1eae588f73498867e4264ef3ed650334c88c2e5c7123fa124e9f732d00ea32e40cffb699006f5c85eb11fa259aa84d556d485548cf8e2f68323767008bfd2335905e042c15619cf3c6a4db61512303061f5cfca7def6f29e34c5afac1284139508ddd0b2aa1887f03b9e5005eb735cece205fd60f6a9fad9e04d72804618093c72b46097f5e328abfae148edf15e076a4c2e4; expires=Sun, 07-Sep-2025 05:16:06 GMT; Max-Age=1727999; path=/; domain=broditshop.no; secure; HttpOnly; SameSite=Lax
location: https://broditshop.no/no/
content-type: text/html; charset=utf-8
date: Mon, 18 Aug 2025 05:16:06 GMT
server: Apache/2.4.58 (Ubuntu)

 

Case B
 

root@ulbokopr02:/var/www/html# curl -I http://broditshop.no
HTTP/1.1 301 Moved Permanently
Date: Mon, 18 Aug 2025 05:18:59 GMT
Server: Apache/2.4.58 (Ubuntu)
Location: https://www.broditshop.no/
Content-Type: text/html; charset=iso-8859-1

root@ulbokopr02:/var/www/html# curl -I https://broditshop.no
HTTP/2 301
location: https://www.broditshop.no/
content-type: text/html; charset=iso-8859-1
date: Mon, 18 Aug 2025 05:19:02 GMT
server: Apache/2.4.58 (Ubuntu)


I checked my apache config files, and in that one it has redirect, I have tried to comment it out and see if that helps, but it still gives same error on site.
 

 

Link to comment
Share on other sites

What your headers say

  • http://broditshop.no → 301 → https://broditshop.no/ (server redirect; fine)
  • https://broditshop.no → 302 → https://broditshop.no/no/ (app redirect; PrestaShop is adding the language code)
  • That second hop is PrestaShop’s “Add language to URL” behavior. By itself that’s OK. The loop usually happens after /no/ if something then kicks you back to / (or to www). We can prevent that by consolidating redirects and tightening BO settings.

Try this 

Keep redirects in one place

  1. Comment out all host/HTTPS redirects in your Apache vhosts for this site (both :80 and :443). Keep SSL/cert lines, PHP handler, etc.—just remove Redirect, RewriteRule, or RewriteCond that alter host/https.
  2. 2) Put ONE simple rule at the very top of your PrestaShop .htaccess

(above the Presta-generated “start” block)

<IfModule mod_rewrite.c>
RewriteEngine On

# Force non-www + HTTPS in one pass; preserve path & query
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://broditshop.no%{REQUEST_URI} [R=301,L]
</IfModule>
 

# Expect 301 → https://yourdomain.no/
curl -I http://yourdomain.no

# Expect 302 → https://yourdomain.no/no/
curl -I https://broditshop.no

# This is the critical one — should be 200 (no further redirects)
curl -I https://broditshop.no/no/
 

Why Case B (www) looked bad

When you tried Case B, everything was pushed to www.broditshop.no, but your shop is configured for non-www. That guarantees a tug-of-war (Apache to www, PrestaShop back to non-www), so stick with Case A.

Edited by El Patron (see edit history)
Link to comment
Share on other sites

34 minutes ago, El Patron said:

What your headers say

  • http://broditshop.no → 301 → https://broditshop.no/ (server redirect; fine)
  • https://broditshop.no → 302 → https://broditshop.no/no/ (app redirect; PrestaShop is adding the language code)
  • That second hop is PrestaShop’s “Add language to URL” behavior. By itself that’s OK. The loop usually happens after /no/ if something then kicks you back to / (or to www). We can prevent that by consolidating redirects and tightening BO settings.

Try this 

Keep redirects in one place

  1. Comment out all host/HTTPS redirects in your Apache vhosts for this site (both :80 and :443). Keep SSL/cert lines, PHP handler, etc.—just remove Redirect, RewriteRule, or RewriteCond that alter host/https.
  2. 2) Put ONE simple rule at the very top of your PrestaShop .htaccess

(above the Presta-generated “start” block)

<IfModule mod_rewrite.c>
RewriteEngine On

# Force non-www + HTTPS in one pass; preserve path & query
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://broditshop.no%{REQUEST_URI} [R=301,L]
</IfModule>
 

# Expect 301 → https://yourdomain.no/
curl -I http://yourdomain.no

# Expect 302 → https://yourdomain.no/no/
curl -I https://broditshop.no

# This is the critical one — should be 200 (no further redirects)
curl -I https://broditshop.no/no/
 

Why Case B (www) looked bad

When you tried Case B, everything was pushed to www.broditshop.no, but your shop is configured for non-www. That guarantees a tug-of-war (Apache to www, PrestaShop back to non-www), so stick with Case A.

Thanks for the suggestions :)

It was what I tried earlier today also, going to www. I did not see, so I missed that in the config I added, but yes that is not an address in use.

For now it still gives error, but here is curl information

root@ulbokopr02:/home/thobo# curl -I http://broditshop.no
HTTP/1.1 301 Moved Permanently
Date: Mon, 18 Aug 2025 13:50:19 GMT
Server: Apache/2.4.58 (Ubuntu)
Location: https://broditshop.no/
Content-Type: text/html; charset=iso-8859-1

root@ulbokopr02:/home/thobo# curl -I https://broditshop.no
HTTP/2 302
set-cookie: PrestaShop-90e51997b8be74dcc470a0950789a219=def5020023a25e6d7bd56c9302aa13e0373f33453099dba6da3244b615ee2ab78f6fbb35e2b4e9353ccb75cb863f81a75afff93940bf2dedca5ace95d5f9a2f1ca910673eda3e920ecfed740e1b88b416ae93c48c0c301263de546b2035fe1747658a998b9deb5e85bb3cd8f2a1a6701b682bbd11cecc3c145302525f0774697dc388babe5f59b7ceea875e18bb0b98a6ac98227a46b00369a7b0c4c665ac832b4338833e22bbd38a3d2e3367026aff892d7722765dfe982e9c93f1583910bcee571a87ef90e72ccb10d738184d60f387f0064b792; expires=Sun, 07-Sep-2025 13:50:29 GMT; Max-Age=1728000; path=/; domain=broditshop.no; secure; HttpOnly; SameSite=Lax
location: https://broditshop.no/no/
content-type: text/html; charset=utf-8
date: Mon, 18 Aug 2025 13:50:29 GMT
server: Apache/2.4.58 (Ubuntu)

root@ulbokopr02:/home/thobo# curl -I https://broditshop.no/no/
HTTP/2 302
set-cookie: PrestaShop-90e51997b8be74dcc470a0950789a219=def50200975d17b79c0ac39720faad641fd6a8c8056122f6e57b664104bb7be3b618039efa86ad0e94ea1f830a25ec5a022911af34dc9d33a6f3a03b7ac2e5f93f03fca3b24eb87cb86942038b09d023b2ed770ef7023991af32cfdf14397238f8f799cefe933ecf2533e81d72a62877ea01ec87a5864d40706a0b2ce9dae0706bdf9ff9a2130afb32c8333831322d200d405b5dbc6fb24a99a097aca9d5fd50b4b8e7edffb9980bc5c1097fbcef9b1e9098475fe6564af29889928a6f06e146d26a16213489cbf1c05cc8da824487d263d427c868; expires=Sun, 07-Sep-2025 13:50:38 GMT; Max-Age=1728000; path=/; domain=broditshop.no; secure; HttpOnly; SameSite=Lax
location: https://broditshop.no/no/
content-type: text/html; charset=utf-8
date: Mon, 18 Aug 2025 13:50:38 GMT
server: Apache/2.4.58 (Ubuntu)
 

 

As for apache config it is only for 80 port it has redirect, and that is commented out

image.png.b431e8919b84f955cf95166135557df2.png

.htaccess file changed

image.thumb.png.7ff7d15ed794ee076db02bb892bd1e07.png

 

Link to comment
Share on other sites

this is my last shot at this :)

https://yourdomain.com/no/ → 302 → https://yourdomain.com/no/ (this is the real problem — a self-redirect loop).

So Apache is now clean, but PrestaShop is redirecting /no/ back onto itself endlessly.

 

1) Database shop URLs

Check your ps_shop_url table (via phpMyAdmin or MySQL). Run:

SELECT id_shop_url, domain, domain_ssl, physical_uri, virtual_uri
FROM ps_shop_url;
 

For a single-shop setup at the root of your domain, the row should be:

  • domain = yourdomain.com
  • domain_ssl = yourdomain.com
  • physical_uri = /
  • virtual_uri = (empty)

If virtual_uri contains no/ right now, PrestaShop thinks your default shop lives at /no/ and will keep redirecting. That explains the loop.

Fix it with:

UPDATE ps_shop_url
SET domain='yourdomain.com',
    domain_ssl='yourdomain.com',
    physical_uri='/',
    virtual_uri=''
WHERE main=1;
 

Afterwards, clear PrestaShop’s cache (delete everything under /var/cache/ inside your shop).

Test again

Link to comment
Share on other sites

8 minutes ago, El Patron said:

this is my last shot at this :)

https://yourdomain.com/no/ → 302 → https://yourdomain.com/no/ (this is the real problem — a self-redirect loop).

So Apache is now clean, but PrestaShop is redirecting /no/ back onto itself endlessly.

 

1) Database shop URLs

Check your ps_shop_url table (via phpMyAdmin or MySQL). Run:

SELECT id_shop_url, domain, domain_ssl, physical_uri, virtual_uri
FROM ps_shop_url;
 

For a single-shop setup at the root of your domain, the row should be:

  • domain = yourdomain.com
  • domain_ssl = yourdomain.com
  • physical_uri = /
  • virtual_uri = (empty)

If virtual_uri contains no/ right now, PrestaShop thinks your default shop lives at /no/ and will keep redirecting. That explains the loop.

Fix it with:

UPDATE ps_shop_url
SET domain='yourdomain.com',
    domain_ssl='yourdomain.com',
    physical_uri='/',
    virtual_uri=''
WHERE main=1;
 

Afterwards, clear PrestaShop’s cache (delete everything under /var/cache/ inside your shop).

Test again

 

Let us see if we can get to it now, but I know that it is already set correctly in DB :( So not sure why it redirects, I do not see any reason for it.

What else can I do? Migrate all data to new installed DB? If so what tables should I move? Is there any other table that can contain something making it redirect wrong?
Before I added old DB and just had the new installation it worked fine, it happened after I moved it.

image.png.77d02534fdff4325cfe9e6d99ab8e9fa.png

 

image.png.032b0c0ac4026c78c6a799a4c1e4798c.png

Link to comment
Share on other sites

we should have paid attention more to @Mehdi Bourechka

This points to PrestaShop’s canonical/SSL/language redirect logic, not Apache.

this is as far as I want to go down this rabbit hole, I recommend getting regular hosting package so you can go build your ecommerce catalog and start selling.

I'm out loool

 

Link to comment
Share on other sites

1 hour ago, El Patron said:

we should have paid attention more to @Mehdi Bourechka

This points to PrestaShop’s canonical/SSL/language redirect logic, not Apache.

this is as far as I want to go down this rabbit hole, I recommend getting regular hosting package so you can go build your ecommerce catalog and start selling.

I'm out loool

 

Problem are that all thoose things are already done, it still gives error, and it does not have anything to do with hosting package, since it is prestashop problem.

And I cannot just move to another one, due to orders and all products etc that are in the old one :(

Thanks for help so far El patron :)

  • Like 1
Link to comment
Share on other sites

Hello,
I'm no expert but I had the same error a few days ago and the support team at my new host found the solution...

I had activated a cache system on the host side, and my Ps was making exactly the same error.

By deactivating the cache system, everything went back to normal.

I hope you'll be able to follow this lead...

Good Luck

Link to comment
Share on other sites

10 hours ago, Selkit said:

Hello,
I'm no expert but I had the same error a few days ago and the support team at my new host found the solution...

I had activated a cache system on the host side, and my Ps was making exactly the same error.

By deactivating the cache system, everything went back to normal.

I hope you'll be able to follow this lead...

Good Luck

Thanks for the suggestions Selkit, tried to removed installed cache system, but did not help, it still goes in error to many redirects.

Link to comment
Share on other sites

After much researching and not finding an solution to why it happens, I figured I would just reinstall the site totally in a new db, and then move /img folder from old site, and the DB over, that made the site work again.

So do not know what file or configuration making the site go in loop, not a exact solution but if someone has this problem it works to upload a totally new prestashop installation and just add a database2 and then change the connection in the config back to old DB or just overwrite the new DB after installation.

  • Like 1
Link to comment
Share on other sites

  • Thbor83 changed the title to [SOLVED] ERR_TOO_MANY_REDIRECTS - Moved site from nginx to apache

It sounds like there may be old redirect rules or cookies causing the loop. Double-check your .htaccess for any leftover redirect rules, and ensure your site’s base URLs in the PrestaShop database (ps_shop_url table) are correct. Also, clear your browser cookies and any server-level cache. Since a fresh PrestaShop install works, it's likely something in your site's configuration, not the server itself. If you’re still stuck, try comparing the settings of your working fresh install with the migrated site, especially in SEO & URL settings.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...