Rewrite for wp-login to hide subdirectory (3 posts)

  1. dugost
    Posted 3 years ago #

    I'm trying to achieve 2 things: a simplified URL for the wp-login page but also a universal rewrite for it.

    I've installed WP in a sub-directory and the htaccess file rewrites to hide it (i.e. mydomain.com/subdir/index.php becomes mydomain.com/index.php). No problem, works like a charm. However, I'd like wp-login.php to do the same thing.

    I've found some posts that show how to edit htaccess to rewrite /subdir/wp-login.php to /login like this:

    RewriteRule ^login$ http://mydomain.com/subdir/wp-login.php [NC,L]
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    This sort of worked but it didn't mask the URL to hide the sub-dir, it seemed to work more like a redirect. It still shows /subdir/wp-login.php in the address bar. Am I missing something here? Shouldn't it simply read /login in the address bar?

    Second part of this is that I have the Page Security by Contexture plugin installed which password protects a page and all of its children. If anyone attempts to visit one of these pages the plug-in sends the visitor to the wp-login.php page but when it does it shows the sub-directory.

    I don't want visitors seeing the sub-directory so I would like to have it so that any time /subdir/wp-login.php is visited that it either masks the URL in the address bar to /login or even just /wp-login.php, makes no difference to me as long as there's no sub-directory visible.

    I've tried to be as clear as possible. Anyone have any ideas on how to achieve this?

  2. dweez
    Posted 3 years ago #

    Hi I am looking how to do the exact same thing. So far I haven't found the answer. Can anyone offer anything up?

  3. Nomina
    Posted 3 years ago #

    Yes. Yes. Yes, PLEASE. Same issue has been driving me insane.

Topic Closed

This topic has been closed to new replies.

About this Topic