Roots Discourse

Prevent /wp-admin redirect to /wp/wp-admin

I have a fresh install of Bedrock which is redirecting www.url.com/wp-admin to www.url.com/wp/wp-admin. For the benefit of obscurity, I would prefer to have to specifically type /wp/wp-admin to access the admin panel.

It looks like previously this was the behaviour:

Thank you!

1 Like

What about using a WordPress plugin for obscuring WP?:



Dear @strarsis thank you for responding.

I’d like to see if there is a non-plugin way to achieve this (so that I can keep the number of plugins to a minimum).

Especially since it appears that in the past, by default, a Bedrock install would require that the /wp/ was required to be specifically typed in the URL path to access wp-admin.

Is anyone else having their site automatically redirect /wp-admin to /wp/wp-admin or is that an issue with my install?

1 Like

The same happens on my setups.
I’d suggest seeing if the redirect_canonical filter has anything to do with it.

Thank you @codepuncher for the suggestion.

I looked into it, and it does seem like that would achieve what I am looking for, but if I were to use the following code:
remove_filter('template_redirect', 'redirect_canonical');
This would also turn off the useful ability for WordPress to redirect users to the closest matching pages across the entire site.

I read that I can do page-by-page special redirect rules, however I am worried that may introduce more problems into my setup as I am not proficient in PHP.

I am left wondering how the original behaviour (no wp-admin redirect to /wp/wp-admin) in Bedrock was accomplished, because in the link that I highlighted above it appears not having a redirect was the default behaviour.

This has got me curious whether:

  1. Originally in Bedrock redirects were off for the entire WordPress site?
  2. Or they had custom code to prevent that specific redirect on wp-admin?
  3. Or at some point between now and 2014 it was decided that redirecting wp-admin to /wp/wp-admin was a good idea (even though no-redirect added a slight benefit to security - as highlighted by a Roots dev in the post I found and linked above)

This topic was automatically closed after 42 days. New replies are no longer allowed.