I have copied a wordpress instance from production to my local. After getting the public side of the site up - public homepage, pages, and blog posts -, I cannot access /wp-admin/ because that url always redirects to the / homepage. I have tried:
- Updating the siteurl and home to "" (homepage and posts work fine)
- Implementing a local self-signed ssl cert (in case it was an https problem.)
- Switched to 2019 theme (theme works, but problem still persists)
- Setting debug constants in wp-config.php
- Removing debug constants in wp-config.php
- Moved the plugins directory aside, replaced with /plugins containing only index.php
Here is a curl of wp-admin:
curl -Ik /wp-admin/
HTTP/1.1 301 Moved Permanently
Server: nginx/1.16.0
Date: Wed, 24 Jul 2019 17:27:39 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.6.40
X-Redirect-By: WordPress
Location: /
Last-Modified: Wed, 24 Jul 2019 17:27:39 GMT
Expires: Wed, 24 Jul 2019 18:27:39 GMT
Pragma: public
Cache-Control: max-age=3600, public
ETag: "d41d8cd98f00b204e9800998ecf8427e"
Strict-Transport-Security: max-age=63072000; includeSubdomains
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-uri: /wp-admin/
Obviously on the production copy the wp-admin url works. Throughout it all, it 301 redirects from /wp-admin to /
How can I prevent it from redirecting?
I have copied a wordpress instance from production to my local. After getting the public side of the site up - public homepage, pages, and blog posts -, I cannot access /wp-admin/ because that url always redirects to the / homepage. I have tried:
- Updating the siteurl and home to "https://tk.local" (homepage and posts work fine)
- Implementing a local self-signed ssl cert (in case it was an https problem.)
- Switched to 2019 theme (theme works, but problem still persists)
- Setting debug constants in wp-config.php
- Removing debug constants in wp-config.php
- Moved the plugins directory aside, replaced with /plugins containing only index.php
Here is a curl of wp-admin:
curl -Ik https://tk.local/wp-admin/
HTTP/1.1 301 Moved Permanently
Server: nginx/1.16.0
Date: Wed, 24 Jul 2019 17:27:39 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.6.40
X-Redirect-By: WordPress
Location: https://tk.local/
Last-Modified: Wed, 24 Jul 2019 17:27:39 GMT
Expires: Wed, 24 Jul 2019 18:27:39 GMT
Pragma: public
Cache-Control: max-age=3600, public
ETag: "d41d8cd98f00b204e9800998ecf8427e"
Strict-Transport-Security: max-age=63072000; includeSubdomains
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-uri: /wp-admin/
Obviously on the production copy the wp-admin url works. Throughout it all, it 301 redirects from https://tk.local/wp-admin to https://tk.local/
How can I prevent it from redirecting?
3 Answers
Reset to default 3In my case, it ended up being some kind of adverse interaction in the nginx wordpress config that I had. Something about not passing along the naked arguments:
location / {
original line: try_files $uri @php;
new line: try_files $uri $uri/ /index.php?$args;
}
And the associated upstream was wrong. Used the config suggested here: https://www.nginx/resources/wiki/start/topics/recipes/wordpress/ For a simpler wordpress nginx config and that solved it.
Please try going into the local database and looking in the options
table for the home and site url. Make sure these values correctly reference the local site URL.
Alternatively, in your local wp-config.php file you could try defining the home and site url constants like this:
define( 'WP_HOME', 'http://example' );
define( 'WP_SITEURL', 'http://example' );
Look into
.htaccess
, there might be set some specific urls/directories, which you might need to remove/change, like:RewriteBase /subdir/
Also, in phpmyadmin, check
wp-options
first and second rows, there should be needed similarly modified site-url .If MultiSite, then change that in
wp-config
too.
tk.local
and switched to a default theme? What does the.htaccess
file look like ontk.local
? When you say you tried Updating the siteurl and home to "tk.local", did you set them totk.local
orhttps://tk.local
? – Pat J Commented Jul 29, 2019 at 18:40