Rewrite for wp-login to hide subdirectory
-
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$ https://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] </IfModule>
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?
- The topic ‘Rewrite for wp-login to hide subdirectory’ is closed to new replies.