strange … anything in the php errorlog sonko?
ah, I just remembered someone else having this issue, turned out he had a plugin (or code snippet) to purge AO’s cache which he had to deactivate. migth you be using the same auto-purge-cache solution?
Well… I didn’t even have time to change anything, I have also installed and network activated cache-enabler and Optimus but as I said – I didn’t change anything so everything is running on default settings. I was running default twentyseventeen theme so no custom code either – htaccess basicauth would be the only custom thing that I did at this point. It was the very clean WP install 😉 I went back and redid the multisite setup for subdomains without domain mapping and everything seems fine. I have used domain mapping and autoptimize together before and never had any problems so far. Nothing in the logs 🙁
cache-enabler wasn’t the problem too – tested with having it on and off
The weird thing is that AO does not have any logic to do redirects. Does domain mapping have that and if so in which case is it done?
Yes, domain mapping can for example map “example.com” to be a part of your multisite which is at “site.com” what you wouldn’t be able to achieve without it. In this case, I admit that I don’t need domain mapping (I just installed it automatically because most of the times I need it) but the problem still exists :/
hmmm … just a hunch; can you comment out line 54-56 in wp-content/plugins/autoptimize/classes/autoptimizeExtra.php and see if that changes anything?
nope :/ It if it helps it seems that I can browse the site without a problem but when I try to access anything on /wp-admin/ I’m getting the redirections
that didn’t help, I gave it 5min and commenting line 108 in autoptimizeMain.php gets rid of the problem, if it makes things easier I can send you db dump and files so you can set up testing environment – just let me know
OK, I reviewed 2.3.4 vs 2.4.1 and the domain-mapping stuff is now done earlier (at
plugins_loaded) while earlier it was done a lot later (in the end_buffering code). I *think* that calling that
get_original_url function too early might be the reason for what you’re seeing.
So the next step would be to try to move some of that stuff around 🙂
So @sonko could you in autoptimizeMain.php on line 53 change:
add_action( 'plugins_loaded', array( $this, 'setup' ) );
add_action( 'init', array( $this, 'setup' ) );
at first sight (quick test of settings & frontend) this does not impact AO functioning and who knows it might allow domain mapper’s
get_original_url() to work?
that made the job – everything seems to be working fine after switching to init action, will the next plugin update contain this fix – can I just leave plugin edited like that?
Thanks for the help!
will the next plugin update contain this fix
I think so.
What do you think about switching hooks for setup from plugins_loaded to init @zytzagoo ?
We can switch, but that’d be a breaking change for anyone else that might be relying on us hooking earlier than init — also, what exactly is causing the redirect loop?
Because I don’t quite see what about calling get_original_url() or content_url() would cause the redirection to kick in?
Granted, I did not yet try to install multisite with domain mapping locally and debug what’s happening — will do it and report back when I get a chance…
Also, which domain mapping plugin was used exactly? Since 4.5+ domain mapping is natively supported if https://codex.wordpress.org/WordPress_Multisite_Domain_Mapping is to be trusted?