Hide WordPress Backend when WP not installed at top level
-
When WordPress is not installed at the top level of the domain, the “Hide WordPress Backend” function writes the wrong rules to the .htaccess file.
For example, my WP site is at https://www.the-gang.ca/roleplay/fiverivers/. When I hide the backend the rewrite rules are (e.g.):
RewriteRule ^login/?$ /roleplay/wp-login.php
when they should be:
RewriteRule ^login/?$ /roleplay/fiverivers/wp-login.php
The defect is in inc/admin/common.php – there are two lines that look like
$siteurl = explode( '/', get_option( 'siteurl' ) );
(Line 691 and 997 in my version). These should both be changed to:
$siteurl = explode( '/', get_option( 'siteurl' ), 4 );
This will prevent the path portion of the URL from being truncated to the first folder level; the full site path will be stored in $siteurl[3].
I hope this helps!
- The topic ‘Hide WordPress Backend when WP not installed at top level’ is closed to new replies.