wordpress - how to make the .htaccess rule work for specified domain ,subdomain or addons -
this cpanel directory structure:
public_html |--->wordpress installed sudomain-directory |--->wordpress installed addon-domain |--->wordpress installed
what have done: based on user choice passwd , .htaccess file created respective domains inside wp-admin directory
.htaccess file
authname "member only" authtype basic authuserfile /home/taragurung/public_html/wp-admin/.passfile require valid-user
now when user try access www.somedomain.com/wp-admin authentication pop , works expected.
problem: problem works wp-admin not www.somedomain.com/wp-login
to make work added
<filesmatch "wp-login.php">
rule , created .htaccess in root directory
but doing make rule apply domains , subdomains
why didn't put in root directory: don't want rules implemented on subdomains , addon domains. want implemented on domains or sub-domain user choose to.
i hope i've understood question correctly - want authentication work if user directs specific domain.
to can use if directive
.
so, if user x
comes domain somedomain.com/wp-login
show authentication, if not, not show it.
<if "%{http_host} == 'somedomain.com/wp-login'"> authname "member only" authtype basic authuserfile /home/taragurung/public_html/wp-admin/.passfile require valid-user </if>
i hope helps , always, clear cache before testing this.
Comments
Post a Comment