Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

5 Answers 5

up vote 3 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

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

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

style.css

/*
Theme Name: turn off frontend
Theme URI: 
Description: 
Author: 
Version: 
License: GNU 
License URI: 
Tags:
*/

and index.php

<?php
exit;
share|improve this answer

Use the plugin Authenticator from @bueltge. Visitors who aren’t logged in see just the login screen, nothing else.

share|improve this answer

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

 
discard

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.