2

when I try my website on localhost, browser shows me redirected you too many times. I tried everything, but no success. Tested on another server too, same situation.

How can I determine the problem and find the catch?

Apache error.log.

[Mon Mar 09 22:46:22.796847 2020] [proxy_fcgi:debug] [pid 9205] mod_proxy_fcgi.c(995): [client ::1:59146] AH01076: url: fcgi://localhost//var/www/html/unihobbyczshop/test/index.php proxyname: (null) proxyport: 0
[Mon Mar 09 22:46:22.796851 2020] [proxy_fcgi:debug] [pid 9205] mod_proxy_fcgi.c(1002): [client ::1:59146] AH01078: serving URL fcgi://localhost//var/www/html/unihobbyczshop/test/index.php
[Mon Mar 09 22:46:22.796854 2020] [proxy:debug] [pid 9205] proxy_util.c(2177): AH00942: FCGI: has acquired connection for (*)
[Mon Mar 09 22:46:22.796860 2020] [proxy:debug] [pid 9205] proxy_util.c(2230): [client ::1:59146] AH00944: connecting fcgi://localhost//var/www/html/unihobbyczshop/test/index.php to localhost:8000
[Mon Mar 09 22:46:22.796884 2020] [proxy:debug] [pid 9205] proxy_util.c(2267): [client ::1:59146] AH02545: fcgi: has determined UDS as /var/run/php/php5.6-fpm.sock
[Mon Mar 09 22:46:22.796946 2020] [proxy:debug] [pid 9205] proxy_util.c(2439): [client ::1:59146] AH00947: connected //var/www/html/unihobbyczshop/test/index.php to httpd-UDS:0
[Mon Mar 09 22:46:22.796965 2020] [proxy:debug] [pid 9205] proxy_util.c(2810): AH02823: FCGI: connection established with Unix domain socket /var/run/php/php5.6-fpm.sock (*)
[Mon Mar 09 22:46:22.803575 2020] [proxy:debug] [pid 9205] proxy_util.c(2192): AH00943: FCGI: has released connection for (*)
[Mon Mar 09 22:46:22.806190 2020] [authz_core:debug] [pid 9171] mod_authz_core.c(809): [client ::1:59150] AH01626: authorization result of Require all granted: granted
[Mon Mar 09 22:46:22.806213 2020] [authz_core:debug] [pid 9171] mod_authz_core.c(809): [client ::1:59150] AH01626: authorization result of <RequireAny>: granted
[Mon Mar 09 22:46:22.806321 2020] [authz_core:debug] [pid 9171] mod_authz_core.c(809): [client ::1:59150] AH01626: authorization result of Require all granted: granted
[Mon Mar 09 22:46:22.806330 2020] [authz_core:debug] [pid 9171] mod_authz_core.c(809): [client ::1:59150] AH01626: authorization result of <RequireAny>: granted
[Mon Mar 09 22:46:22.806347 2020] [proxy:debug] [pid 9171] mod_proxy.c(1229): [client ::1:59150] AH01143: Running scheme unix handler (attempt 0)
[Mon Mar 09 22:46:22.806355 2020] [proxy_fcgi:debug] [pid 9171] mod_proxy_fcgi.c(995): [client ::1:59150] AH01076: url: fcgi://localhost//var/www/html/unihobbyczshop/test/index.php proxyname: (null) proxyport: 0
[Mon Mar 09 22:46:22.806361 2020] [proxy_fcgi:debug] [pid 9171] mod_proxy_fcgi.c(1002): [client ::1:59150] AH01078: serving URL fcgi://localhost//var/www/html/unihobbyczshop/test/index.php
[Mon Mar 09 22:46:22.806366 2020] [proxy:debug] [pid 9171] proxy_util.c(2177): AH00942: FCGI: has acquired connection for (*)
[Mon Mar 09 22:46:22.806373 2020] [proxy:debug] [pid 9171] proxy_util.c(2230): [client ::1:59150] AH00944: connecting fcgi://localhost//var/www/html/unihobbyczshop/test/index.php to localhost:8000
[Mon Mar 09 22:46:22.806379 2020] [proxy:debug] [pid 9171] proxy_util.c(2267): [client ::1:59150] AH02545: fcgi: has determined UDS as /var/run/php/php5.6-fpm.sock
[Mon Mar 09 22:46:22.806466 2020] [proxy:debug] [pid 9171] proxy_util.c(2439): [client ::1:59150] AH00947: connected //var/www/html/unihobbyczshop/test/index.php to httpd-UDS:0
[Mon Mar 09 22:46:22.806502 2020] [proxy:debug] [pid 9171] proxy_util.c(2810): AH02823: FCGI: connection established with Unix domain socket /var/run/php/php5.6-fpm.sock (*)
[Mon Mar 09 22:46:22.812549 2020] [proxy:debug] [pid 9171] proxy_util.c(2192): AH00943: FCGI: has released connection for (*)
[Mon Mar 09 22:46:22.814859 2020] [authz_core:debug] [pid 9172] mod_authz_core.c(809): [client ::1:59154] AH01626: authorization result of Require all granted: granted
[Mon Mar 09 22:46:22.814874 2020] [authz_core:debug] [pid 9172] mod_authz_core.c(809): [client ::1:59154] AH01626: authorization result of <RequireAny>: granted
[Mon Mar 09 22:46:22.814966 2020] [authz_core:debug] [pid 9172] mod_authz_core.c(809): [client ::1:59154] AH01626: authorization result of Require all granted: granted
[Mon Mar 09 22:46:22.814973 2020] [authz_core:debug] [pid 9172] mod_authz_core.c(809): [client ::1:59154] AH01626: authorization result of <RequireAny>: granted
[Mon Mar 09 22:46:22.814987 2020] [proxy:debug] [pid 9172] mod_proxy.c(1229): [client ::1:59154] AH01143: Running scheme unix handler (attempt 0)
[Mon Mar 09 22:46:22.814993 2020] [proxy_fcgi:debug] [pid 9172] mod_proxy_fcgi.c(995): [client ::1:59154] AH01076: url: fcgi://localhost//var/www/html/unihobbyczshop/test/index.php proxyname: (null) proxyport: 0
[Mon Mar 09 22:46:22.814998 2020] [proxy_fcgi:debug] [pid 9172] mod_proxy_fcgi.c(1002): [client ::1:59154] AH01078: serving URL fcgi://localhost//var/www/html/unihobbyczshop/test/index.php
[Mon Mar 09 22:46:22.815013 2020] [proxy:debug] [pid 9172] proxy_util.c(2177): AH00942: FCGI: has acquired connection for (*)
[Mon Mar 09 22:46:22.815020 2020] [proxy:debug] [pid 9172] proxy_util.c(2230): [client ::1:59154] AH00944: connecting fcgi://localhost//var/www/html/unihobbyczshop/test/index.php to localhost:8000
[Mon Mar 09 22:46:22.815027 2020] [proxy:debug] [pid 9172] proxy_util.c(2267): [client ::1:59154] AH02545: fcgi: has determined UDS as /var/run/php/php5.6-fpm.sock
[Mon Mar 09 22:46:22.815080 2020] [proxy:debug] [pid 9172] proxy_util.c(2439): [client ::1:59154] AH00947: connected //var/www/html/unihobbyczshop/test/index.php to httpd-UDS:0
[Mon Mar 09 22:46:22.815102 2020] [proxy:debug] [pid 9172] proxy_util.c(2810): AH02823: FCGI: connection established with Unix domain socket /var/run/php/php5.6-fpm.sock (*)
[Mon Mar 09 22:46:22.820711 2020] [proxy:debug] [pid 9172] proxy_util.c(2192): AH00943: FCGI: has released connection for (*)

Apache conf.

<VirtualHost *:80>
ServerName unihobbyczshop.localhost
DocumentRoot /var/www/html/unihobbyczshop/test
<Directory /var/www/html/unihobbyczshop/test/>
    Options Indexes FollowSymLinks
</Directory>
</VirtualHost>

File .htaccess in root folder.

RewriteEngine On
RewriteBase /

RewriteCond /var/www/html/unihobbyczshop/test/$1/$2 -f
RewriteRule (bin|html|libs)/((.*)\.(htm|html|js|gif|jpg|png|css|ico|php|woff|svg|ttf|eot)$) /var/www/html/unihobbyczshop/test/$1/$2 [NC,L]

RewriteRule \.(htm|html|js|gif|jpg|png|css|ico|php)$ - [NC,L]

RewriteRule (tmp/backend|tmp/frontend|libs|html/templates|mods|_htaccess|_sql) - [NC,L,F]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+[^/])$ /$1/ [R=301,L,QSA,NE]

RewriteCond %{HTTP_HOST} !^unihobbyczshop.localhost
RewriteRule (.*) http://unihobbyczshop.localhost/$1 [R=301,QSA,L]

RewriteRule ^t([a-zA-Z0-9]{32})\/$ /customer/password/?action=3&token=$1 [R=301,L,QSA,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)/?$ /controller.php?MRW_CONTROLLER_URI=$1&MRW_CONTROLLER_HOST=%{HTTP_HOST} [L,QSA,NC]

Thanks.

1

To diagnose this, you need to see what redirects are being issued. I prefer to use curl on the command line:

$ curl --head http://nihobbyczshop.localhost/
HTTP/1.1 301 Moved Permanently
Location: http://nihobbyczshop.localhost/foo

Then make another request for the second location:

$ curl --head http://nihobbyczshop.localhost/foo
HTTP/1.1 301 Moved Permanently
Location: http://nihobbyczshop.localhost/foo

Eventually you will get a situation where something redirects to itself like a demonstrated here. Or you could get a redirect back in a loop to something you previously requested.

You can also view the redirects in Firefox or Chrome's developer tools. In the "Network" tab there should be a "persist" option such that the tab contents won't clear between redirected pages. See on Super User: How to track url redirects in the browser?

| improve this answer | |

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.