WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the WordPress database and back end to administer the news for my band's website and everything is working great however I'd like to disable the front end of WordPress itself.

I have the WordPress installation installed in /wordpress/ and obviously the admin section is under /wordpress/wp-admin/.

What would be the best way to restrict someone from accessing the rather *un*setup WordPress site itself without affecting the admin section?

If anything, I could simply redirect to the website's proper home page (domain.com/).

share|improve this question
up vote 5 down vote accepted

To make sure only the front end redirects to domain.com, make a theme that uses the PHP header() function.

  • Create a folder called redirect or something.
  • Add two files to the folder: style.css and index.php (necessary for a valid WP theme)
  • In style.css, add something like this:

    Theme Name: Redirect
    Description: Redirects the front end to domain.com

  • In index.php add this:

    header( "Location: http://domain.com" );

  • Upload the folder to the themes directory and then activate it in the admin UI.
share|improve this answer
It's funny cause that light just went off in my head. Why not just make a theme that redirects! Thanks. – Nick Bedford May 23 '11 at 9:18

Use a theme with "empty data". Put two files in directory, then activate "theme".


Theme Name: turn off frontend
Theme URI: 
License: GNU 
License URI: 

and index.php

share|improve this answer
I like this solution, this way you can easily switch back to a full working theme. Moreover you can add something like <?php wp_redirect(site_url('wp-admin'));die(); instead of exit to automatically redirect to a given resource. – MiCc83 Jan 15 at 8:45

add this to the .htaccess in your root directory

redirect 301 /wordpress http://www.domain.com

EDIT: This is really just a quick fix, there might be better solutions. Another way would be to add a function to your functions.php file, that is then called in wp_head() to redirect that way. Using that method you could also allow yourself to view it with a simple IP check.

share|improve this answer
This has a side effect that /wordpress/wp-admin now redirects to //wp-admin – Nick Bedford May 23 '11 at 5:53

Put this in your .htaccess and list the paths you want to keep available:

RewriteCond %{REQUEST_URI} !^/wp-admin
RewriteCond %{REQUEST_URI} !^/wp-includes
RewriteCond %{REQUEST_URI} !^/wp-login
RewriteCond %{REQUEST_URI} !^/wp-content/uploads
RewriteCond %{REQUEST_URI} !^/wp-content/plugins
RewriteCond %{REQUEST_URI} !^/wp-content/cache
RewriteRule (.*) http://yournewdomain.com/ [R=301,L]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.