How to redirect WordPress homepage to admin/login form

If you are building a WordPress site where all the action is happening in the back-end, you may not need the front-end at all.

In this case you’d want all visitors coming to the website to go directly to the login/registration form.

Here is a simple way to redirect all front-end requests to the back-end.

1. Edit your theme’s index.php and add these two lines to the top:

header("Location: ".get_admin_url());
exit();

2. Save the file and then remove all other theme files.

It basically tells all requests to redirect to the admin URL. Since, index.php is the only theme file “alive” this will also redirect 404 requests.

Related Articles:

Tagged with 

Comments are closed.