admin管理员组文章数量:1414613
Situation
I'm trying to host 2 Wordpress websites on the same virtual machine.
- Site1: www.mainsite
- Site2: site2.mainsite
Each site has its own Wordpress installation and database (not multisite).
Environment
- Ubuntu 18.04
- Nginx 1.17.1
- PHP7.3-FPM
- Certbot for Let's Encrypt
- HSTS activated for domain
Problem
After installing both Wordpress websites and logging in on wp-admin. The last one starts redirecting to the other one with a 301 redirect.
Steps to reproduce:
- Clear browser cache
- Visit www.mainsite/wp-admin and login
- Visit site2.mainsite/wp-admin and login
- Visit www.mainsite
- Visit site2.mainsite -> Gets redirected to www.mainsite with X-Redirect-By: WordPress in the response header
This is not always true, sometimes it works for a few minutes before it starts to redirect. The 301 redirects get cached by the browser, so when the redirect occurs, it never works again unless I manually clear my browser cache.
Tried solutions
- Clearing browser cache, tried another computer
- Added WP_HOME and WP_SITEURL to both wp-config.php files
- Checked my Nginx server blocks and PHP-pools
- Tried separate SSL certificates with Certbot
- Tried wildcard SSL certificate with Certbot
- Reboot
- Checked both MySQL databases for URLS
Do I have to add something in the Wordpress config to stop the redirect? I think it has something to do with the cookie that got created when logging in.
Situation
I'm trying to host 2 Wordpress websites on the same virtual machine.
- Site1: www.mainsite
- Site2: site2.mainsite
Each site has its own Wordpress installation and database (not multisite).
Environment
- Ubuntu 18.04
- Nginx 1.17.1
- PHP7.3-FPM
- Certbot for Let's Encrypt
- HSTS activated for domain
Problem
After installing both Wordpress websites and logging in on wp-admin. The last one starts redirecting to the other one with a 301 redirect.
Steps to reproduce:
- Clear browser cache
- Visit www.mainsite/wp-admin and login
- Visit site2.mainsite/wp-admin and login
- Visit www.mainsite
- Visit site2.mainsite -> Gets redirected to www.mainsite with X-Redirect-By: WordPress in the response header
This is not always true, sometimes it works for a few minutes before it starts to redirect. The 301 redirects get cached by the browser, so when the redirect occurs, it never works again unless I manually clear my browser cache.
Tried solutions
- Clearing browser cache, tried another computer
- Added WP_HOME and WP_SITEURL to both wp-config.php files
- Checked my Nginx server blocks and PHP-pools
- Tried separate SSL certificates with Certbot
- Tried wildcard SSL certificate with Certbot
- Reboot
- Checked both MySQL databases for URLS
Do I have to add something in the Wordpress config to stop the redirect? I think it has something to do with the cookie that got created when logging in.
Share Improve this question edited Sep 11, 2019 at 7:01 slimag 31 bronze badge asked Jul 22, 2019 at 19:10 RofniRofni 1- Just a comment, but it sounds like the potential solution here is to log out of one site before logging in to the other. – Anaksunaman Commented Jul 23, 2019 at 5:12
1 Answer
Reset to default 0It seems, you have not set opcache.validate_root=1 in php.ini. It's mandatory for chrooted php-fpm with multiple pools (and unfortunately not very clearly documented).
RTFM: https://www.php/manual/en/opcache.configuration.php#ini.opcache.validate-root
本文标签: phpWordpress randomly redirects with 301 after logging in
版权声明:本文标题:php - Wordpress randomly redirects with 301 after logging in 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745168539a2645831.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论