I am testing my own module on Magento CE 2.2.0 but keep getting "The page isn’t redirecting properly". Looking at the network traffic I see these requests:

  • /magento22-acumulus/admin/
  • /magento22-acumulus/admin/admin/index/denied/
  • /magento22-acumulus/admin/admin/auth/login/
  • /magento22-acumulus/admin/admin/
  • /magento22-acumulus/admin/admin/index/denied/
  • /magento22-acumulus/admin/admin/auth/login/
  • /magento22-acumulus/admin/admin/
  • /magento22-acumulus/admin/admin/index/denied/
  • /magento22-acumulus/admin/admin/auth/login/
  • /magento22-acumulus/admin/admin/
  • ...

My setup:

  • local install on base url /magento22-acumulus/
  • Wampserver 3.0.8 with php 7.0.10 and Apache 2.4.23

What I did:

  • install Magento 2.2.0 with sample data
  • settings changed: remove secret key and use standard admin/ url
  • tested it: I do get the login screen
  • install my module, module:enable, setup:upgrade, setup:di:compile
  • tested it: error as above
  • module:disable, cache:clean, setup:di:compile
  • tested it: I do get the login screen
  • repeated this a number of times, same pattern, so I was thinking it had to do with my module.
  • But then I got my module working once and I was able to go to my own pages. Unfortunately the error came back, so I continued to do some debugging enabling and disabling my module but could not locate the problem
  • and now I also get the problem without my module enabled. So I think it is some strange condition/bug in Magento itself.

What could be the problem here?

  • if you got solution please post your answer Jun 8, 2018 at 11:00
  • Unfortunately not yet. I stopped testing my module on MA2.2 and now only test it on MA2.1. My module is used by customers on MA2.2, so more reason to believe it is not some error in my module's config, settings or code. If, eventually, I find a solution, I will post it.
    – fietserwin
    Jun 8, 2018 at 15:54
  • I have same problem . I found out there is problem with my module Helper Class .. You must checkout your modules one by one.. disable to find out which cause error.. Jun 11, 2018 at 8:04
  • can you share image what you get exact error? Dec 16, 2019 at 5:36
  • you tried it a fresh version and no add any extensions or else? Dec 16, 2019 at 5:37

4 Answers 4


I'm not sure whether this is a bug with the compilation process or something wrong with the module code. In my case, Magento compilation was incorrectly creating an interceptor for a class on my module (without an actual defined constructor) which extended another class of another module which extended a class from core Magento (both with defined constructors). This was also creating a blank page in the frontend, besides the problems you mentioned. After several fresh installs of Magento 2.2 and also Magento 2.1 with the same problem this worked for me:

  • Enable developer mode: php bin/magento deploy:mode:set developer
  • Install your module (upload/copy files) then run php bin/magento setup:upgrade
  • Instead of running the compilation process (only needed when the order of constructor arguments is changed or the argument types are changed), just delete the folder /generated/code/YOURMODULENAMESPACE

Since you are using Apache, i suggest you should enable the RewriteLog . Then replicate issue and check logs again.

RewriteLog "logs\rewritelog.txt"    
RewriteLogLevel 3
  • Thanks for your answer, but what could that learn me? I already tried to debug, so I know that each redirected request is processed by Magento. I don't see how Apache comes into the picture?
    – fietserwin
    May 21, 2018 at 18:18
  • Magento is not a webserver. The apache webserver uses Redirects. So, since error is about a redirection, the first place to look for ia what is doing apache. You have 50% chanches to see that apache oa doing weird redirection (http-to-https , or similar) and 50% chanches to see that magento instructs apche to redirect in a weird way, maybe like non-www to www or viceversa.
    – x86fantini
    May 21, 2018 at 18:29
  • Magento returns the redirect instructions to the browser. There is no http versus https problem (like in many other reports about MA2.2 endless redirects), nor www versus non-www, as this is on localhost. The redirects are to the pages as described in the question.
    – fietserwin
    May 22, 2018 at 19:14

Last week, I tried again to install a clean M2.3.4 environment (with sample data) and, hoora, it seems to work. Except, after doing a setup:di:compile this problem appeared again. However, removing the generated code from /generated/code made it work again... So it could be a problem in the generator, or some code that checks for the type of an object and does not cater for the generated interceptor classes...

@Gabriel MdS answered more or less the same thing, but for me it also happened when my own module was not yet installed, so I only had the clean install with sample data.

So, not a definitive answer or solution, but, certainly together with @Gabriel MdS's answer, a strong hint towards the generating process.


I know this is an old tread but it ranked first in my Google search. None of these answers helped me but I experience the same issue and was able to solve it. My setup uses a reverse proxy. Behind the proxy I use http (non-ssl) and before the proxy only https (ssl) is allowed. This caused my redirect problem.

Solution: add the following line (right after the comments) to pub/index.php


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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