Unable to access admin (returns 404 page)

I recently imported a site into Local, and was able to get the site up-and-running locally (as far as I can tell, anyway). However, I am unable to log into the site, either by using the Admin button in the Local interface, or by manually navigating to mysite.local/wp-admin. Either of these actions returns our site’s default 404 page.

As I imported, I ran into several issues, which I solved to the best of my understanding. First, the database did not import at all (perhaps because we use non-standard table names?), so I had to import it through the Adminer interface. This meant that I also had to manually update the urls in the tables, and also update wp-config to point to the table prefix. So, I’m not sure if the inability to login to the admin area is related to the way I imported, but I mention it in case it is relevant.

Otherwise, the site is running just fine locally, no broken links, etc.

Any help you can provide a Wordpress newbie is much appreciated!

Hi Abigail,

Sorry for the trouble!

Are you using a plugin such as https://wordpress.org/plugins/wps-hide-login/?

Also, is the 404 error page the WordPress 404 page or is it one of the simple nginx or Apache 404 pages?

Hi Clay, thanks for the response.

We aren’t using any plugins like wps-hide-login – I think our plugin setup is pretty straightforward. The 404 page is from Wordpress, it is the same page you’d get from any incorrect URL on our site. Other than being unable to access the admin area, everything seems intact. I’m wondering if there’s some additional configuration step I’m missing?

Got it.

Do you get a 404 with both /wp-login.php and /wp-admin?

Yes, in both cases I get a 404, though with /wp-admin I get a redirection (http://tvgs.local/wp-admin/tvgs.local/wp-login.php?redirect_to=http%3A%2F%2Ftvgs.local%2Fwp-admin%2F&reauth=1), is this expected? Navigating to /wp-login doesn’t redirect, but I still get the 404 response.

What are home and siteurl set to in the site’s wp_options table in the database?

Both are set to tvgs.local (I manually changed them, due to the DB not importing automatically when I attempted the original import)

Aha! Both of those options require that you have http:// or https:// before the domain. :smiley:

1 Like

Oh! Thanks so much, I will change it and let you know how it goes.

Edit: It worked! I really appreciate the help.

One question – does the import process in Local not accept table names that don’t have the standard wp_ prefix? I’m curious if this is the reason my database didn’t import totally smoothly at the outset.

Glad it worked!

The import process should work with any prefix.

The only time it may get hung up on the prefix is if you provide a backup without a wp-config.php file and an SQL file that contains multiple sets of WordPress tables with different prefixes.

Hi Clay, I got the same issue as Abigail’s. The thing is I am unable to access my local wordpress dashboard. How do I do it via Adminer?

New to localwp. Created a new site, but the site.local URL was insecure (HTTP only instead of HTTPS). I clicked on the “trust” link to install the SSL and everything went kaput.

I solved the issue by clicking “Open site shell” and then entering the following command in WP CLI to replace all http links with https in the database:

wp search-replace http https

I hope that helps someone.

1 Like

A post was split to a new topic: Unable to Access WP Admin (404 Page)