2

I've already removed the login, registration, and password reset stuff. i also removed all links to the author url from single, archive, and index. now i want to remove the actual route so that bots cannot discover the author username.

2

You can add this to .htaccess file, it will redirect all author requests looking for a number ( Author ID ) to the homepage:

#Disable Author Pages
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI}  ^/$
RewriteCond %{QUERY_STRING} ^/?author=([0-9]*) [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/? [L,R=301,NC]
</IfModule>

The PHP / Wordpress way, you could use Template Redirect:

function author_page_redirect() {
    if ( is_author() ) {
        wp_redirect( home_url() );
    }
}
add_action( 'template_redirect', 'author_page_redirect' );
  • not what i want. i want to remove it entirely from the wordpress application. i also am not running apache – r3wt Mar 25 '15 at 21:45
  • @r3wt This does the same thing, nobody knows it exists because it gets 301 redirected back to the homepage, bots don't know, malicious users don't know, nobody knows. It never gets to the username portion of the URL. – Howdy_McGee Mar 25 '15 at 21:46
  • IM NOT USING APACHE i also want to remove it from the actual application – r3wt Mar 25 '15 at 23:37
  • 1
    @r3wt I'm not sure you can actually remove it as much as you can remove post - it's just built into WordPress. Are you fine with modifying core files? By doing so you won't be able to upgrade without finding those files and making the same modifications. Another option would be to use PHP to do the rewrites for you. It may be beneficial to edit your original question and add a bit more detail. – Howdy_McGee Mar 26 '15 at 0:18
  • 1
    thanks a million for your help. accepting your answer as it definitely solved the problem. – r3wt Mar 26 '15 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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